[asterisk-users] PJSIP add
Dan Cropp
dan at amtelco.com
Tue Aug 25 14:08:22 CDT 2015
Thank you for responding Joshua.
My goal is to send a custom header in the INVITE packet.
A developer wrote a macro using Asterisk and the SIPAddHeader many years ago. He has custom software that looks for this custom header field to know what number the original call came into Asterisk on.
After the SIPAddHeader, a Queue is called.
The basic call flow is the call comes in,
It copies the EXTEN to a DNID variable
exten => _X.,n,Set(__MY_DNID=${EXTEN})
It is sent to AsyncAGI.
exten => _X.,n,AGI(agi:async)
Using AMI, we control the call from there.
>From AMI, we Answer the call.
For testing the very next thing I do is
Action: AGI
ActionID: C15
Channel: PJSIP/3400-00000000
CommandID: C15
Command: EXEC Macro My-SetDNID,${MY_DNID},TestApp
[macro-My-SetDNID]
exten => s,1,Verbose(X-My-DNID:${MY_DNID})
; SIP version (which works)
same => n,SIPAddHeader(X-My-DNID:${MY_DNID})
; PJSIP version code
; same => n,Set(PJSIP_HEADER(add,X-My-DNID)=${MY_DNID})
same => n,Queue(${ARG2})
When using chan_sip, I'm seeing the following INVITE sent to the Agent in the queue...
18:48:01.650180 IP (tos 0x0, ttl 64, id 44633, offset 0, flags [none], proto UDP (17), length 950)
192.168.xxx.xxx.sip > 192.168.yyy.yyy.5063: SIP, length: 922
INVITE sip:TestApp_EmergencyAgent1 at 192.168.yyy.yyy:5063 SIP/2.0
Via: SIP/2.0/UDP 192.168.xxx.xxx:5060;branch=z9hG4bK77caff71
Max-Forwards: 70
From: <sip:3400 at 192.168.xxx.xxx>;tag=as13bb4901
To: <sip:TestApp_EmergencyAgent1 at 192.168.yyy.yyy:5063>
Contact: <sip:3400 at 192.168.xxx.xxx:5060>
Call-ID: 32d64cd37cc3673661a5819818e6201f at 192.168.xxx.xxx:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.5.0
Date: Tue, 25 Aug 2015 18:48:01 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
X-My-DNID: 3344
Content-Type: application/sdp
Content-Length: 290
v=0
o=root 1563523699 1563523699 IN IP4 192.168.xxx.xxx
s=Asterisk PBX 13.5.0
c=IN IP4 192.168.xxx.xxx
t=0 0
m=audio 17706 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv
When using PJSIP, the header
X-My-DNID: 3344 is missing
When using PJSIP, is it possible to have an additional header added into the INVITE when the Asterisk Queue method is called?
Have a great day!
Dan
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Joshua Colp
Sent: Tuesday, August 25, 2015 10:51 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] PJSIP add
Dan Cropp wrote:
> I am trying to set add a SIP Header to a call before adding it to the Queue.
>
> The dial plan sends the call to my macro to perform the work. When I
> use chan_sip, everything works as expected. When I use PSJIP support,
> it's not adding the SIP header.
>
> Looking at the output, I see the macro is called in both cases. In the
> PJSIP case, the added sip header never is showing up in the asterisk
> logs (verbose 999). In the SIP case, I see it.
>
> Does the function Set(PJSIP_HEADER(add, ..... not transfer over to the
> call when the Queue function is called?
>
> Am I calling the Set(PJSIP_Header(add portion incorrectly? Or is this
> a problem with the Asterisk PJSIP support?
PJSIP_HEADER works on the channel it is invoked on. SIPAddHeader does things differently and uses channel variables underneath which can be inherited. What is the exact call flow and where do you expect the headers to appear?
--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list