Re: PJSUA: Set From userpart when making a call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andreas,
i found out, that you can get the INFO of every request in the default module by calling:
PJ_LOG(3,(THIS_FILE, "default_mod_on_tx_request: INFO: %s", pjsip_tx_data_get_info(tdata)));
Prints:
APP  ....default_mod_on_tx_request: INFO: Request msg INVITE/cseq=24079 (tdta0x558cefd79ad8)

So you can write a fancy block by comparing the info and then limit the rx request by using e.g:
pj_str_t info = pj_str(pjsip_tx_data_get_info(tdata));
if ( pj_stristr(&info, pj_str("INVITE")) != NULL ) {
 ... do something
}

Only a thought...

Best regards
Franz

Citycom Telekommunikation GmbH
Gadollaplatz 1
8010 Graz | Austria

________________________________________
Von: Skale Franz
Gesendet: Mittwoch, 27. November 2019 12:11
An: pjsip@xxxxxxxxxxxxxxx
Betreff: AW:  PJSUA: Set From userpart when making a call

Hi Andreas,
i concur, the option should exists.
Rewriting the header must be much easier.

E.g.
to print the user portion of the from header, you have to:
Snippet:
pjsip_fromto_hdr *from;
if ( ( from = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_FROM, NULL)) == NULL )
    PJ_LOG(3,(THIS_FILE, "default_mod_on_tx_request: No FROM header in message"));
  else {
    pjsip_sip_uri *sip_uri = (pjsip_sip_uri*)pjsip_uri_get_uri(from->uri);
    PJ_LOG(3,(THIS_FILE, "default_mod_on_tx_request: From: %s", sip_uri->user.ptr));
  }
What strikes me is, that there's no exact exaplanation how to rewrite headers.
So,i was forced to read the pjsip plugin source of asterisk.
Still learning btw.

I use pj-sua.
Currently i'm writing on a loop check which calls an external
number and then, with the help of a fabulous Beronet Berofix,
route it back to check is external calls are working for different providers.
Quality assurance, as you may call it.

Best regards
Franz

Citycom Telekommunikation GmbH
Gadollaplatz 1
8010 Graz | Austria
________________________________________
Von: pjsip <pjsip-bounces@xxxxxxxxxxxxxxx> im Auftrag von Andreas Wehrmann <a.wehrmann@xxxxxxxxxx>
Gesendet: Mittwoch, 27. November 2019 11:47
An: pjsip@xxxxxxxxxxxxxxx
Betreff: Re:  PJSUA: Set From userpart when making a call

On 27.11.19 10:49, Skale Franz wrote:
> Hi Andreas,
> IMHO, you should be able to "rewrite" any header by using the pjsip_module mod_default_handler.
>
> Best regards
> Franz
>
> Citycom Telekommunikation GmbH
> Gadollaplatz 1
> 8010 Graz | Austria
>
> ________________________________________
>

Howdy,

Thanks for the suggestion but I don't really like this approach for this
particular use-case.
I know that the "From" header is set once when the INVITE session is
created and kept throughout the lifetime of the session.
Being able to influence what is set when the session is created seems to
me to be the cleaner and easier approach because
I'd need to do it only once and not need any extra modules which is why
I brought this up in the first place.

@Franz - Out of interest: Are you using pjsua or pjsip directly?

Best Regards,
Andreas


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux