[SR-Users] Send SIP Info within a dialog using $uac_req(method)="INFO"

Daniel-Constantin Mierla miconda at gmail.com
Mon Dec 5 11:33:10 CET 2016


Hello,


this is only when you do jsonrpc over http, but it is not the case here.
See my previous response in this discussion thread.


Cheers,
Daniel


On 02/12/2016 15:28, Jonathan Hunter wrote:
>
> Hi Daniel,
>
>
> I can see when people are using curl they can define content-type ;
>
>
> /--header 'Content-Type: application/json'/
> However is this  possible within the jsonrpc_exec command, as this
> seems to set the body.
>
>
> Can you define the Content-Type before firing the command?
>
>
> Thanks
>
>
> Jon
>
>
>
> ------------------------------------------------------------------------
> *From:* sr-users <sr-users-bounces at lists.sip-router.org> on behalf of
> Jonathan Hunter <hunterj91 at hotmail.com>
> *Sent:* 01 December 2016 16:12
> *To:* Kamailio SER - Users Mailing List; miconda at gmail.com
> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
> $uac_req(method)="INFO"
>  
> Hi Daniel, 
>
> I am trying tm.t_uac_start and its stating Content-Type Missing, I
> have tried to add to params but it doesnt like it, where should it be
> defined?
>
> Command below;
>
>
> jsonrpc_exec('{"jsonrpc":"2.0","method":"tm.t_uac_start","params":
> ["INFO",
> "$dlg(to_uri)",".",".","From:$var(testjon)\r\n","To:$var(testjon2)\r\n","Contact:$var(testjon4)\r\n","Content-Type:
> application/json\r\n","Content-Length: 0\r\n"]}');
>
> And logs;
>
> Dec  1 16:09:15 POC_ProxyA /usr/sbin/kamailio[11883]: INFO: <script>:
> getting here Content-Type missing
> Dec  1 16:09:15 POC_ProxyA /usr/sbin/kamailio[11883]: INFO: <script>:
> getting here
> {"jsonrpc":"2.0","error":{"code":-32000,"message":"Execution Error"}}
>
> Thanks
>
>
> Jon
>
>
>
> ------------------------------------------------------------------------
> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
> *Sent:* 01 December 2016 12:31
> *To:* Jonathan Hunter; Kamailio SER - Users Mailing List
> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
> $uac_req(method)="INFO"
>  
>
> Hello,
>
>
> tm.t_uac_start is another rpc command than what was tried before, this
> one doesn't do async operation.
>
> Cheers,
> Daniel
>
> On 01/12/2016 13:28, Jonathan Hunter wrote:
>>
>> Hello,
>>
>>
>> I am currently still using the exec module, so within the .cfg file,
>> as when using jsonrpc-s its coming up with the async command issue
>> again, I presume this will still be the case?
>>
>>
>> Ok I will try with the combinations you mention.
>>
>>
>> Many thanks
>>
>>
>> Jon
>>
>>
>>
>> ------------------------------------------------------------------------
>> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
>> *Sent:* 01 December 2016 12:24
>> *To:* Jonathan Hunter; Kamailio SER - Users Mailing List
>> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
>> $uac_req(method)="INFO"
>>  
>>
>> Hello,
>>
>>
>> are you still trying with MI command via kamctl? Not with the
>> jsonrpc-s module and tm.t_uac_start?
>>
>>
>> When double quotes disappear is likely due to command line
>> interpreter, so you need to put two of them for each one you have
>> now, then ones than need to stay should be with more backslashes.
>>
>>
>> Also, you can try to use single quotes to enclose the parameter
>> values and let the double quotes in the content of the parameter.
>>
>>
>> Cheers,
>> Daniel
>>
>>
>> On 30/11/2016 15:38, Jonathan Hunter wrote:
>>> Hi,
>>>
>>> I am just testing with the mi t_uac_dlg command, and I am trying to
>>> create an additional header, which is sent in the SIP INFO message
>>> and actually contains double quotes.
>>>
>>> So in my kamailio.cfg script file I set the variable;
>>>
>>>
>>> $var(testjon8) = "p1=\"STOP\"";
>>>
>>> xlog("L_INFO","We are going to try and use $var(testjon8)\n");
>>>
>>> And when seeing in the logs I see it states;
>>>
>>> We are going to try and use p1="STOP"
>>>
>>> And p1="STOP" is exactly what I want.
>>>
>>> However when I generate the SIP INFO message, and check on the wire
>>> using wireshark I see;
>>>
>>> Event:p1=STOP
>>>
>>> So it doesnt have the double quotes I would like.
>>>
>>> How can I escape them so the t_uac_dlg command includes them?
>>>
>>> The portion where this header is generated in the command is;
>>>
>>>
>>> exec_avp("kamctl mi t_uac_dlg INFO $dlg(to_uri) . .
>>> \\\"From:'$var(testjon)'\"\\r\\nTo:$var(testjon2)\\r\\nCall-ID:$var(testjon3)\\r\\nAllow:$var(Allow)\\r\\nContact:$var(testjon4)\\r\\nEvent:$var(testjon8)\\r\\n\\\"\"",
>>> "$avp(test)");
>>>
>>>
>>>
>>> And also running debug I see it as Event:p1="STOP"\r\n\""
>>>
>>>
>>> Can you tell me how I can escape " so its actually within the SIP
>>> header itself?
>>>
>>> Many thanks
>>>
>>> Jon
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>> *From:* sr-users <sr-users-bounces at lists.sip-router.org> on behalf
>>> of Jonathan Hunter <hunterj91 at hotmail.com>
>>> *Sent:* 25 November 2016 18:55
>>> *To:* Kamailio SER - Users Mailing List; miconda at gmail.com
>>> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
>>> $uac_req(method)="INFO"
>>>  
>>>
>>> Hi Daniel,
>>>
>>>
>>> Great thanks very much, will give it a try.
>>>
>>>
>>> Jon
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
>>> *Sent:* 22 November 2016 18:46
>>> *To:* Jonathan Hunter; Kamailio SER - Users Mailing List
>>> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
>>> $uac_req(method)="INFO"
>>>  
>>>
>>> Hello,
>>>
>>>
>>> got a bit of time to look at the code and discovered that there is a
>>> rpc command tm.t_uac_start added by ser guys that might get you
>>> moving forward. It is not waiting for the reply of the generated
>>> request and you can use it with json rpc exec function in the
>>> config, so it avoids using exec.
>>>
>>>
>>> Can you give it a try?
>>>
>>>
>>> Some documentation can be found in the comments of the function used
>>> by this command:
>>>
>>>   -
>>> https://github.com/kamailio/kamailio/blob/master/modules/tm/rpc_uac.c#L399
>>>
>>> Cheers,
>>> Daniel
>>>
>>>
>>> On 22/11/2016 18:35, Jonathan Hunter wrote:
>>>>
>>>> Hi Daniel,
>>>>
>>>>
>>>> Thanks here you go;
>>>>
>>>>
>>>> [root at POC_ProxyA kamailio]# kamctl mi t_uac_dlg INFO
>>>> sip:3003 at 193.144.1.112 . udp:10.70.1.136:5060  
>>>>  \"From:sip:1234 at 8.8.8.8"\r\nTo:sip:3003 at 193.144.1.112\r\nContact:sip:daemon at 8.8.8.8\r\n\""
>>>> 404 Invalid local socket
>>>> [root at POC_ProxyA kamailio]# VERBOSE=1 kamctl mi t_uac_dlg INFO
>>>> sip:3003 at 193.144.1.112 . udp:10.70.1.136:5060  
>>>>  \"From:sip:1234 at 8.8.8.8"\r\nTo:sip:3003 at 193.144.1.112\r\nContact:sip:daemon at 8.8.8.8\r\n\""
>>>> database engine 'MYSQL' loaded
>>>> Control engine 'FIFO' loaded
>>>> entering fifo_cmd t_uac_dlg INFO sip:3003 at 193.144.1.112 .
>>>> udp:10.70.1.136:5060 "From:sip:1234 at 8.8.8.8
>>>> To:sip:3003 at 193.144.1.112
>>>> Contact:sip:daemon at 8.8.8.8
>>>> "
>>>> 404 Invalid local socket
>>>> FIFO command was:
>>>> :t_uac_dlg:kamailio_receiver_23469
>>>> INFO
>>>> sip:3003 at 193.144.1.112
>>>> .
>>>> udp:10.70.1.136:5060
>>>> "From:sip:1234 at 8.8.8.8
>>>> To:sip:3003 at 193.144.1.112
>>>> Contact:sip:daemon at 8.8.8.8
>>>> "
>>>>
>>>>
>>>> Thanks
>>>>
>>>>
>>>> Jon
>>>>
>>> Daniel-Constantin Mierla
>>> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>> Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com
>>
>> -- 
>> Daniel-Constantin Mierla
>> twitter.com/miconda -- linkedin.com/in/miconda
>> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
>
> -- 
> Daniel-Constantin Mierla
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20161205/744b38e0/attachment.html>


More information about the sr-users mailing list