Asterisk 13 Pjsip Manipulate To: Header on Dial

Hello;
i wonder how to manipulate To header on Dialing with PJSIP. i was using exclamation on SIP dialing as below.

it is just a trunk between an operator in pjsip endpoints

SIP/sales@mysipproxy!sales@edvina.net

I tried to the same format for PJSIP dial but i got error. how to manipulate it?

PJSIP/kamailio/sip:103129113423@ip!sip:3129113423@ip

[Jul 29 10:47:15] ERROR[25951]: res_pjsip.c:2785 ast_sip_create_dialog_uac: Could not create dialog to endpoint ‘kamailio’ as URI ‘sip:10213129113423@ip!sip:3129113423@ip’ is not valid
[Jul 29 10:47:15] ERROR[25951]: chan_pjsip.c:1921 request: Failed to create outgoing session to endpoint ‘kamailio’
[Jul 29 10:47:15] WARNING[26205][C-0000001f]: app_dial.c:2432 dial_exec_full: Unable to create channel of type ‘PJSIP’ (cause 3 - No route to destination)

Thanks

You can’t manipulate it currently from the dialplan. What are you trying to change?

Hello;
i have sip proxy that strip prefix on request uri. when the call starts from asterisk , request_uri and to_uri is always equal. Sip proxy strip request uri but cant strip to_uri. UAC decline INVITE request because of to_uri and request uri isnt equal. i can solve this problem with above solution with sip but not pjsip. it is sound bad for me. how i can solve this? any idea

Cheers.

FLow

asterisk R-Uri 103129113423 => SIP PROXY R-Uri 3129113423 ==== > UAC
To-uri 103129113423 => To-Uri 103129113423 ==== >UAC
<=================500 Overlapping ==================

If you configured the outbound proxy in an endpoint and just dialed the URI normally using that endpoint it may work…

Hello;
it doesnt work because concact header , to_uri and request uri are all differen with outbound_proxy parameter. Here is pjsip.conf.

it replace contact header to “asterisk@ip:5060” , to_uri is “sip:103129113423@ip” and request uri “sip:3129113423@ip”

[global]
max_forwards=30
user_agent=FAXDISPATCHER
keep_alive_interval=60
[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0

[kamailio]
type=endpoint
transport=simpletrans
context=netgsm
disallow=all
allow=ulaw
allow=alaw
allow=g729
t38_udptl=yes
t38_udptl_maxdatagram=40
t38_udptl_ec=redundancy
t38_udptl_nat=yes
direct_media=yes
rtp_symmetric=yes
outbound_proxy=sip:ip;lr

[kamailio]
type=identify
endpoint=kamailio
match=ip
match=domain.localdomain

Then I’m afraid there’s no way in chan_pjsip to currently do what you want. You would need to modify the code and add the functionality.

Thanks for replies, i will try to modify code.
Cheers.

Hello;
there is function for Callerıd and has a abilirty set/get DNID (dialed number id). can it manipulate toHeader.i tried to set/get this function but couldnt get any variable.

i am coding for a function for setting toheader under func folder , and it needs a field in astchannel like toheaderfield. But main problem is that could you accept it for master? can anyone lead it for suggestion? i sent a mail to asterisk-dev but has no response.

i realized that Invite request dont set contact number in contact header with specified configuration , it sets only asterisk.

Thanks

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_CALLERID

Were you signed up on the mailing list? I don’t see anything about that on it…

As for your question no, it can’t manipulate the To header. When creating the SIP dialog the same URI is used for both the request header and the To URI. As for adding a “toheaderfield” to the channel structure this would not be accepted. Channel variables already exist that are generic which can be set and read. That would be the quickest way to do it.

Hi Been pulling my hair out for four days now on this issue but with SIP not PJSIP.
When I dial using Dial(SIP/4455667788!4455667788) asterisk doesn’t set To: Header Display Info User Part.
I have tried all kinds of escape formats and am stuck…
someone please help a man out of misery…!
Any help on this will be highly appreciated.

@Jayrue there is a example for usage and it is working very well with me. is it local dialing? try to add your asterisk ip at the end of dial like “SIP/number!number@localip”

@jcolp i think i sent mail before my subscribtion is confirmed. i will have a look another way to solve this option for pjsip

@ycaner.
thanks for responding… soon as I do that asterisk rejects the call with error : “number” is purely numeric hostname and call fails… using the format u just described. if I use SIP/number@ip!number@ip then that works but info part is not set.
looking again at your message you say to use @localip ??
do you mean the ip of the asterisk ?

i wrote it for local calling that means peer to peer call.
i had a look coding for to header setting , and i can say there isnt anyting for info part. it sets only number part on to header.

To :“info is empty” < sip: number @ ip >; totagasdad

I meant the name in To: Header
To: “xxxxx”< sip:xxxxx@domain >
I SWEAR it worked a few days ago now am stumped
had to put spaces as page hides urls
Haven’t slept for 3 days…!

@ycaner. wait are you saying it CANT be done?? to copy the Destination number to the To: “xxxx” field ??

if i can find code sample in chan_sip.c , i paste it . there is a only “if” for setting to header number.
if there is “!” in dialstring it sets number section ,not name section! when i found out it , i had a little smile for it.

  • AGI Script Executing Application: (Dial) Options: (SIP/445566778898!445566778899@10.22.2.17;user=phone;Display-info=“44777777777”)
    [2016-08-10 13:38:07] WARNING[12772][C-0000000d]: chan_sip.c:6064 create_addr: Purely numeric hostname (445566778898), and not a peer–rejecting!
    [2016-08-10 13:38:07] WARNING[12772][C-0000000d]: app_dial.c:2411 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 - Subscriber absent)

nope! i looked code for it and it doesnt set name section, only number section

add "" to accept other info

/* Find optional DNID (SIP to-uri) and From-CLI (SIP from-uri)
* and strip it from the dial string:
* [!touser[@todomain][![fromuser][@fromdomain]]]
* For historical reasons, the touser@todomain is passed as dnid
* while fromuser@fromdomain are split immediately. Passing a
* todomain without touser will create an invalid SIP message. */

yes :frowning:
Just saw this… my C not too good but is that what this does ?

/* Find DNID and take it away */
dnid = strchr(tmp, '!');
if (dnid != NULL) {
	*dnid++ = '\0';
	ast_string_field_set(p, todnid, dnid);
}

add "" to accept other info ??
confused…