[Freeswitch-users] How to encapsulate binary code to SIP body
windy
xiaofengcanyuexp at 163.com
Wed Jun 5 11:48:32 MSD 2013
I have it tested and it works!
Thank you so much!
windy
2013-06-05
发件人: Steven Ayre
发送时间: 2013-06-05 14:48:21
收件人: FreeSWITCH Users Help
抄送:
主题: Re: [Freeswitch-users] How to encapsulate binary code to SIP body
Just google base64... It's a way on encoding binary data using only printable ASCII characters. There are other ways to encode data too.
If you're actually wanting to send the raw data though I've just read up the sofia api...
Create a sip_payload_t initialised by SIPTAG_PAYLOAD_INIT2(data,length) and then use it with the SIPTAG_PAYLOAD() macro.
That'll handle \0 bytes correctly. Passing the data to SIPTAG_PAYLOAD_STR() won't as it'll treat it as a null terminated string.
-Steve
On Wednesday, June 5, 2013, windy wrote:
Hi, Steve
The data is not very large. Normall it's an ISUP message and no more than 256 bytes.
For the base64 encode, can you give an example?
Thanks
windy
2013-06-05
发件人: Steven Ayre
发送时间: 2013-06-05 11:57:05
收件人: FreeSWITCH Users Help
抄送:
主题: Re: [Freeswitch-users] How to encapsulate binary code to SIP body
Does it have to be sent as binary? How about using something like base64 to encode it first?
You also want to be careful sending a large amount of data in this way. If your packet gets larger than the PMTU then you'll get packet fragmentation which SIP/UDP doesn't handle well.
-Steve
On 5 June 2013 03:47, windy <xiaofengcanyuexp at 163.com> wrote:
Dear support
I now need to encapsulate one binary array to FS SIP body. To be specific:
(1) I encoded some info when getting incoming 183.
(2) The encoded info need to be encapsulated as one of content in SIP body like
content-type=application/test
content-length=74
--boundarycode
1233444444444 --------------------binary code
I'd like to add to the sipbody by using:
nua_Respond(...
...
SIPTAG_PAYLOAD_STR(), RAG_END).
Well, As you know, SIPTAG_PAYLOAD_STR is for string, it will truncate the binary array before it encapsulats the binary code to SIP body.
Is there any way to encapsulated my binary array to the SIP boday with "nua_Respond"?
Thanks
Windy
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130605/1b17b689/attachment.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list