[Semsdev] AmSipDialog::refer function with expires

Balint Kovacs bkovacs at gammatelecom.hu
Tue May 19 14:48:25 CEST 2009


Hi,

I think the newline is necessary.
Without the newline the headers seems like this:

Contact: <sip:1010 at 10.10.10.10:5060>
Refer-To: sip:1111 at 11.11.11.11:5060Max-Forwards: 70
Content-Length: 0

So, yes it is a bug currently.



I extended the IVR plugin for sending BYE with headers.

Index: IvrDialogBase.cpp
===================================================================
--- IvrDialogBase.cpp    (revision 1354)
+++ IvrDialogBase.cpp    (working copy)
@@ -182,12 +182,18 @@
   return Py_None;
 }
 
-static PyObject* IvrDialogBase_bye(IvrDialogBase* self, PyObject*)
+static PyObject* IvrDialogBase_bye(IvrDialogBase* self, PyObject* args)
 {
+  char* hdrs=0;
+
   assert(self->p_dlg);
-  self->p_dlg->dlg.bye();
+  if(!PyArg_ParseTuple(args,"s", &hdrs))
+    return NULL;
+
+  self->p_dlg->dlg.bye(hdrs);
   Py_INCREF(Py_None);
   return Py_None;
+ 
 }
 
 //





Stefan Sayer wrote:
> Hello,
>
> o Balint Kovacs [05/19/09 12:59]:
>> Hello,
>>
>> I also have a header modification. It is about a REFER expires.
> how about the trailing newline? your patch adds a \n in both cases. Is 
> that a bug currently?
>
> Thanks
> Stefan
>
>>
>> Index: AmSipDialog.h
>> ===================================================================
>> --- AmSipDialog.h    (revision 1108)
>> +++ AmSipDialog.h    (working copy)
>> @@ -176,7 +176,7 @@
>>    int invite(const string& hdrs,           const string& content_type,
>>           const string& body);
>> -  int refer(const string& refer_to);
>> +  int refer(const string& refer_to, int expires = -1);
>>    int transfer(const string& target);
>>    int drop();
>>  
>> Index: AmSipDialog.cpp
>> ===================================================================
>> --- AmSipDialog.cpp    (revision 1108)
>> +++ AmSipDialog.cpp    (working copy)
>> @@ -449,11 +449,21 @@
>>    }    }
>>  
>> -int AmSipDialog::refer(const string& refer_to)
>> +int AmSipDialog::refer(const string& refer_to,
>> +                       int expires)
>>  {
>>    switch(status){
>>    case Connected:
>> -    return sendRequest("REFER", "", "", "Refer-To: "+refer_to);
>> +    if(expires > -1)
>> +    {
>> +       char tmp[22];
>> +       sprintf(tmp, "%d", expires);
>> +       return sendRequest("REFER", "", "", "Refer-To: 
>> "+refer_to+"\nExpires: "+ tmp  +"\n");
>> +    }
>> +    else
>> +    {
>> +       return sendRequest("REFER", "", "", "Refer-To: "+refer_to+"\n");
>> +    }
>>    case Disconnecting:
>>    case Pending:
>>      DBG("refer(): we are not yet connected."
>>
>>
>> If you think it would be useful to have it in the general release, 
>> please apply the patch.
>>
>> :-)
>>
>> Balu
>>
>>
>> -- 
>>       Balint Kovacs
>> Software Engineer
>> Gamma Telecom
>> Mobile     +36 (06) 70 244 6677
>> Phone     +44 (0) 207 078 8213
>> Email     bkovacs at gammatelecom.com <mailto:bkovacs at gammatelecom.com>
>> Web     www.gammatelecom.com <http://www.gammatelecom.com>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Semsdev mailing list
>> Semsdev at lists.iptel.org
>> http://lists.iptel.org/mailman/listinfo/semsdev
>


-- 
  	Balint Kovacs
Software Engineer
Gamma Telecom
Mobile 	+36 (06) 70 244 6677
Phone 	+44 (0) 207 078 8213
Email 	bkovacs at gammatelecom.com <mailto:bkovacs at gammatelecom.com>
Web 	www.gammatelecom.com <http://www.gammatelecom.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.iptel.org/pipermail/semsdev/attachments/20090519/e463ea17/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mobile.jpg
Type: image/jpeg
Size: 4063 bytes
Desc: not available
URL: <http://lists.iptel.org/pipermail/semsdev/attachments/20090519/e463ea17/attachment-0005.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phone.jpg
Type: image/jpeg
Size: 4099 bytes
Desc: not available
URL: <http://lists.iptel.org/pipermail/semsdev/attachments/20090519/e463ea17/attachment-0006.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: email.jpg
Type: image/jpeg
Size: 4003 bytes
Desc: not available
URL: <http://lists.iptel.org/pipermail/semsdev/attachments/20090519/e463ea17/attachment-0007.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: web.jpg
Type: image/jpeg
Size: 4112 bytes
Desc: not available
URL: <http://lists.iptel.org/pipermail/semsdev/attachments/20090519/e463ea17/attachment-0008.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: footer.jpg
Type: image/jpeg
Size: 9212 bytes
Desc: not available
URL: <http://lists.iptel.org/pipermail/semsdev/attachments/20090519/e463ea17/attachment-0009.jpg>


More information about the Semsdev mailing list