[asterisk-users] PJSIP add

Dan Cropp dan at amtelco.com
Tue Aug 25 12:35:12 CDT 2015


Sorry, replied to the wrong message.


-----Original Message-----
From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Dan Cropp
Sent: Tuesday, August 25, 2015 12:32 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] PJSIP add

In doing a little research, it seems the Referred-By header could be added after the pjsip_xfer_initiate.
This is the approach PJSIP did for some code as far back as PJSIP 1.6.

    /*
     * Create REFER request.
     */
    status = pjsip_xfer_initiate(sub, dest, &tdata);
    if (status != PJ_SUCCESS) {
	pjsua_perror(THIS_FILE, "Unable to create REFER request", status);
	pjsip_dlg_dec_lock(dlg);
	return status;
    }

    /* Add Referred-By header */
    gs_hdr = pjsip_generic_string_hdr_create(tdata->pool, &str_ref_by,
					     &dlg->local.info_str);
    pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)gs_hdr);


    /* Add additional headers etc */
    pjsua_process_msg_data( tdata, msg_data);

    /* Send. */
    status = pjsip_xfer_send_request(sub, tdata);
    if (status != PJ_SUCCESS) {
	pjsua_perror(THIS_FILE, "Unable to send REFER request", status);
	pjsip_dlg_dec_lock(dlg);
	return status;
    }

Could anyone provider some insight into how difficult this might be for me to add and submit for approval?  Depending on the answer, my manager may be willing to let me work on this.
I've developed in C/C++ for over 25 years so I'm plenty familiar with the language.
I'm less familiar with the syntax and coding standards of Asterisk.  I know the group is very good at letting people know about their mistakes and how to fix them.

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

--
_____________________________________________________________________
-- 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