Johan Lentz and others: BUG: on_tx_request gets called with NULL buffer for the first transmission, and has correct data only in retransmissions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This bug has been identified after Johan Lentz's suggestion for being able to modify the outgoing SIP headers in INVITE messages(example CONTACT header).  Thanks, Johan.
If there is any other good and correct way to add / modify the headers, the suggestion would be of tremendous help.

Johan Lentz / others:
I had taken the first approach that you were suggesting, and found that on_tx_request has NULL buffer for the first transmission, and only the retransmission has the correct buffer.  The odd thing is that, even though the first of these on_tx_requests contain NULL packets, it still sends out the correct SIP message to the destination!

Here is a quick summary of the result of the bug:
static pj_bool_t on_tx_request( pjsip_tx_data *rdata )
{
   static int noOfEntries = 0;
   ++ noOfEntries;
   printf ("--------------------------------------------------\n");
   printf ("For Entry : %d, Start: %d Cur: %d End: %d\n", noOfEntries, rdata->buf.start, rdata->buf.cur, rdata->buf.end);
   printf ("--------------------------------------------------\n");
   return PJ_SUCCESS;
}

The output in consolidated form is:
For Entry : 1, Start: 0 Cur: 0 End: 0 // The SIP packet is transmitted out!!
For Entry : 2, Start: 6106872 Cur: 6107640 End: 6108872
For Entry : 3, Start: 6106872 Cur: 6107640 End: 6108872

The outputFile is attached as output.txt
I had made very limited modifiations the simpleua.c file (from the sample test directory).  The file is also attached here.
This is how the executable was run:
   ./simpleua sip:200*200*10000 at 10.8.39.35:5060
Bala

-----Original Message-----
From: pjsip-bounces@xxxxxxxxxxxxxxx [mailto:pjsip-bounces at lists.pjsip.org] On Behalf Of Johan Lantz
Sent: Thursday, June 18, 2009 1:17 AM
To: pjsip at lists.pjsip.org
Subject: Re: PJSip: How to modify SIP headers, like From, To and Contact, fields? (Johan Lantz)

Hi Bala

Other may have better suggestions but I think one way to modify outgoing messages could be to add a pjsip module that modifies the message before it is printed to the continous buffer. Look in the doc for handling on_tx_request.

In the case of the Contact header for pjsua there is a config element that allows you to add extensions to the contact parama. Maybe you could use this as a reference.

/**
     * Additional URI parameters that will be appended in the Contact header
     * for this account. This will affect the Contact header in all SIP 
     * messages sent on behalf of this account, including but not limited to
     * REGISTER, INVITE, and SUBCRIBE requests or responses.
     *
     * The parameters should be preceeded by semicolon, and all strings must
     * be properly escaped. Example:
     *	 ";my-param=X;another-param=Hi%20there"
     */
    pj_str_t	    contact_params;

/Johan

Message: 1
Date: Wed, 17 Jun 2009 11:50:00 -0700
From: "Muthusamy, Balamurugan" <bmuthusa@xxxxxxxxxxxx>
Subject: PJSip: How to modify SIP headers, like From,	To and
	Contact fields?
To: "pjsip at lists.pjsip.org" <pjsip at lists.pjsip.org>
Message-ID:
	<48A510997E574B4FBE5F146FED29CEFA380156BAE1 at NALASEXMB04.na.qualcomm.com>
	
Content-Type: text/plain; charset="us-ascii"

I am using P J Sip of pjproject-1.2, in linux.

I have a need to modify / add to the core SIP header fields, like To, From and Contact.

Here is an example:
This is the current contact message that PJSIP INVITE creates (for outgoing INVITE):
Contact: <sip:858*610*10000 at 10.8.39.34:5060>

I need to change this to something like this: Contact: <sip:858*610*10000 at 10.8.39.34:5060>;cache;range="23,24,25,26"

Modifying the "local Contact" argument of pjsip_dlg_create_uac, and passing it "<sip:858*610*10000 at 10.8.39.34:5060>;cache;range="23,24,25,26"" causes a failure of pjsip_dlg_create_uac.

Any ideas how to do this?
Bala


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: output.txt
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090619/23dde034/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: simpleua.c
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090619/23dde034/attachment-0001.c>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux