[python] send_request not working when headers are None or empty

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

 



Hi!

While trying to send DTMF tones as SIP INFO requests I found that
send_request does not work properly when headers are None:

This doen't wok:

body = "Signal=%s\r\nDuration=100\r\n" % digit
call.send_request("INFO", None, "application/dtmf-relay", body)

But this does the job:

body = "Signal=%s\r\nDuration=100\r\n" % digit
call.send_request("INFO", ("X-Foo=bar"), "application/dtmf-relay", body)

By reading the pjsua.py code I found this code:

        if hdr_list and body:
            msg_data = _pjsua.Msg_Data()
            if hdr_list:
                msg_data.hdr_list = hdr_list
            if content_type:
                msg_data.content_type = content_type
            if body:
                msg_data.msg_body = body
        else:
            msg_data = None

And obviously msg_data will be None if headers are None :)


-- 
Sa?l -- "Nunca subestimes el ancho de banda de un cami?n lleno de disketes."
----------------------------------------------------------------
http://www.saghul.net/



[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