[pjsip] Python PSJUA.py - adding headers don't work
Peuralahti Jari
Jari.Peuralahti at elisa.fi
Thu Mar 4 10:05:34 CST 2010
Found the solution by using tuplets..
header_list = []
header_list.append(("Subject","Foo"))
buddy.send_pager(input,content_type='text/plain',hdr_list=header_list)
will work nicely
-jari-
>-----Original Message-----
>From: pjsip-bounces at lists.pjsip.org
>[mailto:pjsip-bounces at lists.pjsip.org] On Behalf Of Peuralahti Jari
>Sent: Thursday, March 04, 2010 10:54 AM
>To: pjsip at lists.pjsip.org
>Subject: [pjsip] Python PSJUA.py - adding headers don't work
>
>
>
>
>
>In the pjsua documentation http://www.pjsip.org/python/pjsua.htm#Buddy
>
>is written that optional headers can be added using hdr_list:
>
>send_pager(self, text, im_id=0, content_type='text/plain',
>hdr_list=None)
> Send instant message to remote buddy.
>
> Keyword arguments:
> text -- Instant message to be sent
> im_id -- Optional instant message ID to identify this
> instant message when delivery status callback
> is called.
> content_type -- MIME type identifying the instant message
> hdr_list -- Optional list of headers to be sent with the
> request.
>
>how ever I have not applied get to this work right.
>
>This is what I have tryed
> header_list = []
> header_list.append("Subject=Test")
> header_list.append('Subject: Foo')
> header_list.append('Subject:, foo')
> ... some code
>
>
>
>buddy.send_pager(input,content_type='text/plain',hdr_list=header_list)
>
>and for result I get SIP MESSAGE with basic headers, but none
>of my optional headers except four ":" empty lines:
>
>MESSAGE sip:jari at mydomain.fi SIP/2.0.
>Via: SIP/2.0/UDP
>myip:5080;rport;branch=z9hG4bKPjRT8HRroNeYqMblLt8bxfSxI7rDfAUZR4.
>Max-Forwards: 70.
>From: <sip:jari at mydomain.fi>;tag=Rro.mo0pMTmkoiS8cAs74ELT4X.eve98.
>To: <sip:jari at mydomain.fi>.
>Call-ID: gA5YAVKuj-jRmVItXv.qE9VwM4dPpODt.
>CSeq: 63465 MESSAGE.
>Accept: text/plain, application/im-iscomposing+xml.
>Contact: <sip:jari at myip.fi:5080>.
>User-Agent: Jari's Python Script.
>: .
>: .
>: .
>: .
>Route: <sip:sip.mydomain.fi;lr>.
>Proxy-Authorization: Digest username="jari",
>realm="mydomain.fi",
>nonce="4b8e859d000005f04bf656f8fdd980b78d865ef27632a8e9",
>uri="sip:jari at mydomain.fi",
>response="a94938b0df8be6c407d95d93e5aa02d1",
>cnonce="0u45VvJKoydngfonnRbaapVgvuIhr.00", qop=auth, nc=00000001.
>Content-Type: text/plain.
>Content-Length: 12.
>.
>TEST MESSAGE
>-------------------------
>
>What I am doing wrong or isit a bug?
>
>Cheers,
>
>Jari
>
>
>_______________________________________________
>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
>
More information about the pjsip
mailing list