Just google base64... It's a way on encoding binary data using only printable ASCII characters. There are other ways to encode data too.<div><br></div><div>If you're actually wanting to send the raw data though I've just read up the sofia api...</div>
<div><br></div><div>Create a sip_payload_t initialised by SIPTAG_PAYLOAD_INIT2(data,length) and then use it with the SIPTAG_PAYLOAD() macro.</div><div><br></div><div>That'll handle \0 bytes<span></span> correctly. Passing the data to SIPTAG_PAYLOAD_STR() won't as it'll treat it as a null terminated string.</div>
<div><br></div><div>-Steve</div><div><div><br><br>On Wednesday, June 5, 2013, windy wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div style="MARGIN:10px;FONT-FAMILY:verdana;FONT-SIZE:10pt">
<div><font color="#000080" face="Verdana">Hi, Steve</font></div>
<div><font color="#000080"></font> </div>
<div><font color="#000080">The data is not very large. Normall it's an ISUP
message and no more than 256 bytes.</font></div>
<div><font color="#000080"></font> </div>
<div><font color="#000080">For the base64 encode, can you give an
example?</font></div>
<div><font color="#000080"></font> </div>
<div><font color="#000080" face="Verdana"></font> </div>
<div><font color="#000080" face="Verdana">Thanks</font></div>
<div><font color="#c0c0c0" face="Verdana"> <span>windy</span></font></div><font color="#000080" face="Verdana">
<hr style="WIDTH:100px" align="left" color="#b5c4df" size="1">
</font>
<div><font color="#c0c0c0" face="Verdana"> 2013-06-05</font></div>
<hr color="#b5c4df" size="1">
<div><font face="Verdana"><strong>发件人:</strong> Steven Ayre </font></div>
<div><font face="Verdana"><strong>发送时间:</strong> 2013-06-05 11:57:05
</font></div>
<div><font face="Verdana"><strong>收件人:</strong> FreeSWITCH Users Help
</font></div>
<div><font face="Verdana"><strong>抄送:</strong> </font></div>
<div><font face="Verdana"><strong>主题:</strong> Re: [Freeswitch-users] How
to encapsulate binary code to SIP body </font></div>
<div><font face="Verdana"></font> </div>
<div><font face="Verdana">Does it have to be sent as binary? How about
using something like base64 to encode it first?
<div><br></div>
<div>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.<br>
<div><br></div>
<div>-Steve</div>
<div><br></div>
<div><br><br>
<div class="gmail_quote">On 5 June 2013 03:47, windy <span dir="ltr"><<a href="javascript:_e({}, 'cvml', 'xiaofengcanyuexp@163.com');" target="_blank">xiaofengcanyuexp@163.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote"><u></u>
<div style="MARGIN:10px;FONT-FAMILY:verdana;FONT-SIZE:10pt">
<div><font color="#000080" face="Verdana">Dear support</font></div>
<div><font color="#000080"></font> </div>
<div><font color="#000080">I now need to encapsulate one binary array to FS SIP
body. To be specific:</font></div>
<div><font color="#000080">(1) I encoded some info when getting incoming 183.
</font></div>
<div><font color="#000080">(2) The encoded info need to be encapsulated as one
of content in SIP body like</font></div>
<div><font color="#000080">
content-type=application/test</font></div>
<div><font color="#000080">
content-length=74</font></div>
<div><font color="#000080">
--boundarycode</font></div>
<div><font color="#000080"> 1233444444444
--------------------binary code</font></div>
<div><font color="#000080"></font> </div>
<div><font color="#000080">I'd like to add to the sipbody by using:</font></div>
<div><font color="#000080"> nua_Respond(...</font></div>
<div><font color="#000080">
...</font></div>
<div><font color="#000080">
SIPTAG_PAYLOAD_STR(), RAG_END).</font></div>
<div><font color="#000080"></font> </div>
<div><font color="#000080">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.</font></div>
<div><font color="#000080"></font> </div>
<div><font color="#000080"></font> </div>
<div><font color="#000080">Is there any way to encapsulated my binary array to
the SIP boday with "nua_Respond"?</font></div>
<div><font color="#000080"></font> </div>
<div><font color="#000080"></font> </div>
<div><font color="#000080">Thanks</font></div><span><font color="#888888">
<div><font color="#000080">Windy</font></div></font></span></div><br>_________________________________________________________________________<br>Professional
FreeSWITCH Consulting Services:<br><a href="javascript:_e({}, 'cvml', 'consulting@freeswitch.org');" target="_blank">consulting@freeswitch.org</a><br><a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>FreeSWITCH-powered
IP PBX: The CudaTel Communication Server<br><a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br><br>Official FreeSWITCH
Sites<br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br><a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br><a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>FreeSWITCH-users mailing
list<br><a href="javascript:_e({}, 'cvml', 'FreeSWITCH-users@lists.freeswitch.org');" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div></div></font></div></div>
</blockquote></div></div>