[OpenSIPS-Users] mi_json parameters format

Răzvan Crainea razvan at opensips.org
Thu Sep 25 10:18:04 CEST 2014


Hi, Gary!

It looks like curl treats \n as two different characters, instead of 
newline. You should probably try to urlencode the SIP message before 
passing it to curl.

Best regards,

Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com

On 09/24/2014 09:51 PM, Gary Nyquist wrote:
> Hi Răzvan,
> Thanks for pointing out.
> Tried it. Got the following error:
> ERROR:core:get_hdr_field: bad body for <From: 
> sip:1111111111 at 10.0.0.30\r\nTo: 
> sip:1000001115 at 10.0.0.30\r\nContent-Type: text/plain\r\n>(4)
> DBG:core:set_err_info: ec: 1, el: 3, ei: 'error parsing headers'
> DBG:core:get_hdr_field: error exit
> INFO:core:parse_headers: bad header field
> Is there any other parameters missing for "t_uac_dlg"?
> Regards
> -Girish
> *Sent:* Wednesday, September 24, 2014 at 3:39 AM
> *From:* "Răzvan Crainea" <razvan at opensips.org>
> *To:* users at lists.opensips.org
> *Subject:* Re: [OpenSIPS-Users] mi_json parameters format
> Hi, Gary!
>
> Actually I just realized that you are not passing the headers 
> parameter correctly. You separate the headers with comma, whereas they 
> all should be a single parameter.
> Can you try the following command?
>
> curl 
> "127.0.0.1:8888/json/t_uac_dlg?params=OPTIONS,sip:1000001115 at 10.0.0.30,.,.,From: 
> sip:1111111111 at 10.0.0.30\r\nTo: 
> sip:1000001115 at 10.0.0.30\r\nContent-Type: text/plain\r\n"
>
> Best regards,
> Răzvan Crainea
> OpenSIPS Solutions
> www.opensips-solutions.com
> On 09/23/2014 09:45 PM, Gary Nyquist wrote:
>
>     Hi Răzvan,
>     I tried enclosing with quotes; but it made no difference
>     OPTIONS packet did not go out of the box.
>     The log still shows the same:
>     DBG:mi_json:mi_json_run_mi_cmd: command=t_uac_dlg accepts parameters
>     DBG:mi_json:mi_json_run_mi_cmd: got string param [OPTIONS]
>     DBG:mi_json:mi_json_run_mi_cmd: got string param
>     [sip:1000001115 at 10.0.0.30]
>     DBG:mi_json:mi_json_run_mi_cmd: got string param [.]
>     DBG:mi_json:mi_json_run_mi_cmd: got string param [.]
>     DBG:mi_json:mi_json_run_mi_cmd: got string param [From:
>     sip:1111111111 at 10.0.0.30]
>     DBG:mi_json:mi_json_run_mi_cmd: got string param [To:
>     sip:1000001115 at 10.0.0.30]
>     DBG:mi_json:mi_json_run_mi_cmd: got string param [Content-Type:
>     text/plain]
>     DBG:mi_json:mi_json_run_mi_cmd: got mi_rpl=[0x7fe1bdee44d0]
>     DBG:mi_json:mi_json_answer_to_connection: building on page
>     [0x7fe1bdd633b0:0]
>     DBG:mi_json:mi_json_build_page: start
>     DBG:mi_json:mi_json_build_content: start
>     DBG:mi_json:mi_json_build_content: done
>     DBG:httpd:answer_to_connection: MHD_create_response_from_data
>     [0x7fe1bdd633b0:0]
>     Any more tips?
>     Thanks a lot.
>     BR
>     - Gary
>     *Sent:* Tuesday, September 23, 2014 at 7:41 AM
>     *From:* "Răzvan Crainea" <razvan at opensips.org>
>     *To:* users at lists.opensips.org
>     *Subject:* Re: [OpenSIPS-Users] mi_json parameters format
>     Hi, Gary!
>
>     Have you tried quoting the entire curl parameter using quotes?
>
>     curl
>     "127.0.0.1:8888/json/t_uac_dlg?params=OPTIONS,sip:1000001115 at 10.0.0.30,.,.,From:
>     sip:1111111111 at 10.0.0.30,To:
>     sip:1000001115 at 10.0.0.30,Content-Type: text/plain"
>
>     Best regards,
>
>     Răzvan Crainea
>     OpenSIPS Solutions
>     www.opensips-solutions.com
>
>     On 09/22/2014 07:23 PM, Gary Nyquist wrote:
>
>         Hi Răzvan,
>         Thanks for the response.
>         The "get_statistics" command works fine with the
>         comma-separated params.
>         Facing problem with 't_uac_dlg' command.
>         Can't figure out how to pass the headers in the params.
>         As per the 'tm' module doc:
>
>
>               |t_uac_dlg|
>
>         Generates and sends a local SIP request.
>
>         Parameters:
>
>          *
>
>             /method/ - request method
>
>          *
>
>             /RURI/ - request SIP URI
>
>          *
>
>             /NEXT HOP/ - next hop SIP URI (OBP); use “.” if no value.
>
>          *
>
>             /socket/ - local socket to be used for sending the
>             request; use “.” if no value.
>
>          *
>
>             /headers/ - set of additional headers to be added to the
>             request; at least “From” and “To” headers must be specify)
>
>          *
>
>             /body/ - (optional, may not be present) request body (if
>             present, requires the “Content-Type” and “Content-length”
>             headers)
>
>         I want to send (say) an OPTIONS packet.
>         The following fifo commands works fine:
>         opensipsctl fifo t_uac_dlg OPTIONS "sip:1000001115 at 10.0.0.30"
>         . . "\"From: sip:1111111111 at 10.0.0.30\r\nTo:
>         sip:1000001115 at 10.0.0.30\r\nContent-Type: text/plain\r\n"\"
>         But, 'mi_json' command won't work.
>         Have tried (without luck) with several permutations, including
>         the follwoing:
>         curl
>         127.0.0.1:8888/json/t_uac_dlg?params=OPTIONS,sip:1000001115 at 10.0.0.30,.,.,From:
>         sip:1111111111 at 10.0.0.30,To:
>         sip:1000001115 at 10.0.0.30,Content-Type: text/plain
>         Have tried with url encoing the complete params query string;
>         but no OPTIONS packet goes out.
>         No errors in the log also (debug level 4).
>         Any clues?
>         Regards
>         -Gary
>         *Sent:* Monday, September 22, 2014 at 8:11 AM
>         *From:* "Răzvan Crainea" <razvan at opensips.org>
>         *To:* users at lists.opensips.org
>         *Subject:* Re: [OpenSIPS-Users] mi_json parameters format
>         Hi, Gary!
>
>         As the documentation indicates, you should pass the parameters
>         separated
>         by comma. You can try something like this:
>
>         curl
>         "http://127.0.0.1:8888/JSON/get_statistics?params=tm:,dialog:"
>
>         Best regards,
>
>         Răzvan Crainea
>         OpenSIPS Solutions
>         www.opensips-solutions.com <http://www.opensips-solutions.com>
>
>         On 09/18/2014 11:41 PM, Gary Nyquist wrote:
>         > Hi,
>         >
>         > I am trying to use the MI interface to generate SIP MESSAGE
>         packets locally
>         > and send out to remote SIP UA.
>         >
>         > The 'opensipsctl fifo' method works fine.
>         > The 'mi_datagram' method works fine.
>         >
>         > But not able to make "mi_json" work with "t_uac_dlg".
>         > Basically, can't figure out how the parameters for
>         "t_uac_dlg" be formatted for the mi_json query.
>         >
>         > Reading the manual, I understand that the "parameters are to
>         be comma-separated then URI-encoded."
>         > The following working fine:
>         > curl 10.0.0.30:8888/json/get_statistics?params=all
>         >
>         > But can't figure out how to pass the parameters for
>         "t_uac_dlg" command.
>         >
>         > Any help / advice?
>         >
>         > Thanks
>         > -Gary
>         >
>         > _______________________________________________
>         > Users mailing list
>         > Users at lists.opensips.org
>         > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>         _______________________________________________
>         Users mailing list
>         Users at lists.opensips.org
>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>         _______________________________________________
>         Users mailing list
>         Users at lists.opensips.org
>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>     _______________________________________________ Users mailing list
>     Users at lists.opensips.org
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> _______________________________________________ Users mailing list 
> Users at lists.opensips.org 
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140925/9eb22827/attachment-0001.htm>


More information about the Users mailing list