ig0rb
March 24, 2021, 10:28am
1
Hi,
I’m testing chan_pjsip and I cannot find a way to manipolate “From” and “To” headers, in chan_sip I use a dialstring like that:
SIP/sales@mysipproxy!sales@edvina.net
or
SIP/customer@mysipproxy!!customersupport@wearespindle.com
In PJSIP i tryed to use PJSIP_HEADER in the post dial hook, without success:
-- Executing [add@test-pjsip-header:23] Set("PJSIP/AST2-0000001e", "PJSIP_HEADER(update,To)=<sip:123456@192.168.1.11>") in new stack
[Mar 24 11:21:14] ERROR[26158]: res_pjsip_header_funcs.c:381 update_header: There was no header named To.
I tried “to and To”, using only the 123456 or a sip uri, without success…
Does anyone know how “convert”:
SIP/sales@mysipproxy!sales@edvina.net
for PJSIP?
Thanks
jcolp
March 24, 2021, 10:39am
2
The only thing that is possible in a Dial string is specifying a URI to dial at an endpoint:
PJSIP/endpoint/sip:1000@test.com
If an outbound proxy is specified on endpoint then it would go to the outbound proxy with the URI as the To. The only manipulation of the From is the callerid information, or from_user/from_domain in the endpoint configuration.
ig0rb
March 24, 2021, 10:58am
3
Thanks for your fast reply, I will try to look the source code and I will try to check if it’s possible to use “pbx_builtin_getvar_helper” somewhere without broking all
ig0rb
March 24, 2021, 10:31pm
4
Hi,
I’m trying to understand how pjsip work, and I wrote a custom res_pjsip_xxx.c to do some test.
I know the code is ugly, it’s just a test…
static void outgoing_request(struct ast_sip_session *session, pjsip_tx_data * tdata) {
char buffer[8192];
const char *val = NULL;
pjsip_msg_print(tdata->msg, buffer, 8192);
//ast_log(LOG_ERROR, "\nAAAOUT1 REQ [%i]\n%s\n\n", tdata->msg->type, buffer);
if ((val = pbx_builtin_getvar_helper(session->channel, "IB"))) {
ast_log(LOG_WARNING, "AAAOUT2 REQ [%s]\n", val);
pjsip_fromto_hdr *to;
to = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_TO, NULL);
pjsip_name_addr *to_id_name_addr = (pjsip_name_addr *)to->uri;
pjsip_sip_uri *to_uri = pjsip_uri_get_uri(to_id_name_addr);
pj_strset2(&to_uri->user, val);
pjsip_tx_data_invalidate_msg(tdata);
}
I’m able to set the To: username part, but I cannot manipulate the to header in the generated ACK…
Some ideas?
These are developer level questions, and would be better on the developer mailing list or IRC channel.
system
Closed
April 23, 2021, 10:36pm
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.