Is It Possible To Perform PJSIP Add Header Prior To Calling Queue And Have It Part Of The INVITE Packet?

Home » Asterisk Users » Is It Possible To Perform PJSIP Add Header Prior To Calling Queue And Have It Part Of The INVITE Packet?
Asterisk Users 9 Comments

I have a call coming in. I need to add a SIP Header to the channel. Then, I need to send the call to the Queue so it is sent to the Agent.

The SIP header I added, I need to have appear in the INVITE sent to the Agent.

It works in chan_sip. I send the call to a macro which does… n,SIPAddHeader(My-Header-Name:${MY-HEADER-VALUE})
n,Queue(${ARG2})

In PJSIP , this doesn’t seem to work. Is there any way to add custom PJSIP headers to be sent as part of the INVITE to the Agent?
When I look at the code, it seems as though the INVITE doesn’t look for any custom headers to be included with the INVITE packet. Is this correct?

Have a great day!
Dan

9 thoughts on - Is It Possible To Perform PJSIP Add Header Prior To Calling Queue And Have It Part Of The INVITE Packet?

  • To add a header to the call leg that goes to the agent, try using a local channel to activate dialplan on the outbound call:

    Register Local/number@agent in the queue on behalf of the agent (replace number with the agent’s extension number)

    In dialplan [agent], wild card match the number, add the header, and then Dial(PJSIP/{$EXTEN}) to send the call to the agent.

  • VGhhbmtzIFNjb3R0Lg0KDQpJ4oCZbSB0YWtpbmcgb3ZlciBmb3Igc29tZW9uZSBlbHNl4oCZcyBj b2RlLCBzbyBJIG11c3QgYWRtaXQgSeKAmW0gc3RpbGwgbGVhcm5pbmcgdGhlIEFnZW50IGFuZCBR
    dWV1ZSBjb25jZXB0cy4gIExvY2FsIGNoYW5uZWxzIGFyZSBzb21ldGhpbmcgSSBoYXZlIG5vdCB1
    c2VkIGVpdGhlci4gIFdvdWxkIGxvY2FsIGNoYW5uZWxzIGVzc2VudGlhbGx5IGJlIGFuIGludGVy bmFsIGJyaWRnZT8NCg0KSG93IHdvdWxkIEkNCuKAnFJlZ2lzdGVyIExvY2FsL251bWJlckBhZ2Vu dCBpbiB0aGUgcXVldWUgb24gYmVoYWxmIG9mIHRoZSBhZ2VudCAocmVwbGFjZSBudW1iZXIgd2l0
    aCB0aGUgYWdlb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hbmQgQ29sb2NhdGlvbiBQcm92aWRlZCBieSBodHRwOi8vd3d3LmFwaS1kaWdp dGFsLmNvbSAtLQ0KTmV3IHRvIEFzdGVyaXNrPyBKb2luIHVzIGZvciBhIGxpdmUgaW50cm9kdWN0
    b3J5IHdlYmluYXIgZXZlcnkgVGh1cnM6DQogICAgICAgICAgICAgICBodHRwOi8vd3d3LmFzdGVy aXNrLm9yZy9oZWxsbw0KDQphc3Rlcmlzay11c2VycyBtYWlsaW5nIGxpc3QNClRvIFVOU1VCU0NS
    SUJFIG9yIHVwZGF0ZSBvcHRpb25zIHZpc2l0Og0KICAgaHR0cDovL2xpc3RzLmRpZ2l1bS5jb20v bWFpbG1hbi9saXN0aW5mby9hc3Rlcmlzay11c2Vycw0KDQoNCg0KLS0NCltEaWdpdW0gbG9nb10N
    ClNjb3R0IEdyaWVwZW50cm9nDQpEaWdpdW0sIEluYyDCtyBTb2Z0d2FyZSBEZXZlbG9wZXINCjQ0
    NSBKYW4gRGF2aXMgRHJpdmUgTlcgwrcgSHVudHN2aWxsZSwgQUwgMzU4MDYgwrcgVVMNCmRpcmVj dC9mYXg6ICsxIDI1NiA0MjggNjIzOSDCtyBtb2JpbGU6ICsxIDI1NiA1ODAgNjA5MA0KQ2hlY2sg dXMgb3V0IGF0OiBodHRwOi8vZGlnaXVtLmNvbSDCtyBodHRwOi8vYXN0ZXJpc2sub3JnDQo

  • Den 2015-08-28 kl. 00:07, skrev Dan Cropp:

    You have to use an pre-dial handler option in the Dial command:

    same => n,Dial(PJSIP/Agent1,,b(set_header^s^1))

    [set_header]
    exten => s,1,Set(PJSIP_HEADER(add,X-My-DNID2)=${MY_DNID})
    same => n,Return

    /niklas

  • Thank you Niklas

    That solved my problem.

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Niklas Larsson Sent: Friday, August 28, 2015 1:55 AM
    To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] Is it possible to perform PJSIP Add Header prior to calling Queue and have it part of the INVITE packet?

    Den 2015-08-28 kl. 00:07, skrev Dan Cropp:

    I have both the PJSIP add and the chan_sip way of adding SIP headers in there. The Verbose is showing the variable value is there. The INVITE to PJSIP/Agent1 does not include either X-My-DNID or X-My-DNID2 headers.

    You have to use an pre-dial handler option in the Dial command:

    same => n,Dial(PJSIP/Agent1,,b(set_header^s^1))

    [set_header]
    exten => s,1,Set(PJSIP_HEADER(add,X-My-DNID2)=${MY_DNID})
    same => n,Return

    /niklas

  • I’m running into a new problem because of the Local channels.

    I add Local/Agent1 using QueueAdd. When the PJSIP Agent dials a feature code, it adds/removes/pauses/unpauses the appropriate EmergencyAgent for the queue.

    When the code executes the Queue, I was planning to have that Local section dial plan Dial the appropriate PJSIP EmergencyAgent endpoint (using the pre-dial).

    However, the Queue never sees the local channels because they have no device state.
    [Aug 28 18:05:06] DEBUG[17868][C-00000004] app_queue.c: TestApp_EmergencyAgent5 is unavailable because his device state is ‘invalid’
    [Aug 28 18:05:06] DEBUG[17868][C-00000004] app_queue.c: TestApp_EmergencyAgent3 is unavailable because his device state is ‘invalid’
    [Aug 28 18:05:06] DEBUG[17868][C-00000004] app_queue.c: TestApp_EmergencyAgent2 is unavailable because his device state is ‘invalid’
    [Aug 28 18:05:06] DEBUG[17868][C-00000004] app_queue.c: TestApp_EmergencyAgent1 is unavailable because his device state is ‘invalid’

    It seems I may be stuck using chan_sip since it’s Queue behavior does add any SIPADDHEADERs when it executes the INVITE.

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Dan Cropp Sent: Friday, August 28, 2015 8:20 AM
    To: Asterisk Users Mailing List – Non-Commercial Discussion Subject: Re: [asterisk-users] Is it possible to perform PJSIP Add Header prior to calling Queue and have it part of the INVITE packet?

    Thank you Niklas

    That solved my problem.

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Niklas Larsson Sent: Friday, August 28, 2015 1:55 AM
    To: asterisk-users@lists.digium.com

    Subject: Re: [asterisk-users] Is it possible to perform PJSIP Add Header prior to calling Queue and have it part of the INVITE packet?

    Den 2015-08-28 kl. 00:07, skrev Dan Cropp:
    I have both the PJSIP add and the chan_sip way of adding SIP headers in there. The Verbose is showing the variable value is there. The INVITE to PJSIP/Agent1 does not include either X-My-DNID or X-My-DNID2 headers.

    You have to use an pre-dial handler option in the Dial command:

    same => n,Dial(PJSIP/Agent1,,b(set_header^s^1))

    [set_header]
    exten => s,1,Set(PJSIP_HEADER(add,X-My-DNID2)=${MY_DNID})
    same => n,Return

    /niklas