Sorry - lots of issues with the overall implementation here.

-   It doesn't quite implement the ABNF
    -   the icid-value should always be first, whereas your code allows it to be anywhere in the list
    -   it should be icid-value= not icid=
    -   you're not allowing for whitespace between the parameter name and the = sign
    -   the ANBF allows there to be additional generic parameters, but your code would throw an exception.
-   You're not using utility functions in PJSIP that would make the job a lot easier, and common idioms from their parsing code.  For example, there is a common idiom for parsing parameter lists which you could use for the charge-params part of the ABNF 

    while (*scanner->curptr == ';')
    {
      pjsip_param *p = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);
      pjsip_parse_param_imp(scanner, ctx->pool, &p->name, &p->value, 0);
      pj_list_insert_before(&hdr->other_param, p);
    }

   In your case you would substitute the pj_list_insert_before for tests on the p->name against the various parameters you want to pull out into the main structure, and only do the pj_list_insert_before for the generic parameters.