2010/3/11 Trevor Nunes <trevor.nu...@gmail.com>:
> I'm trying to send encapsulated 3GPP2 MO-SMS ( CDMA text message ). To do
> this the first byte of the payload must be 0x00, if I use SIP_PAYLOAD_STR(
> data ) and first byte is zero it seems to truncate assuming the 0x0 is a
> NULL terminator.
>
> I've tried using SIP_PAYLOAD( sip_payload_t my_payload ) but not making much
> progress. I can successfully generate L2-ACK's since the first byte is
> always 0x02.
>
> void send_3gpp2_sms_mo(nua_t *nua, sip_t const *sip)
> {
>  nua_handle_t *h;
>  sip_payload_t payload = SIP_PAYLOAD_INIT;
>
>  char mo_payload[] =  {
>        0x00, 0x00, 0x10, 0x02   // P2P MSG + Teleservice ID
>       ,0x04, 0x02, 0x02, 0x07
>       ,0x62, 0x69, 0x69, 0x69   // Phone number garbled for email!
>       ,0x80, 0x55, 0x01, 0x06
>       ,0x08, 0x38, 0x00, 0x16
>       ,0x20, 0x03, 0x50, 0x0d
>       ,0x03, 0x01, 0x0d, 0x10
>       ,0x0a, 0x50, 0x40, 0x01   // Tele Type
>       ,0x07, 0x0e, 0x09, 0x05   // Callback and other crap
>       ,0x2a, 0x1a, 0x4c, 0x3c
>       ,0x00, 0x80, '\0'
>     };
>
>   fprintf(stderr,"smsagent: Tx SMS to phone \n");
>   h = nua_handle(nua, NULL, SIPTAG_TO_STR(gREMOTE_CLIENT_TAG), TAG_END() );
>   nua_message(h, SIPTAG_CONTENT_TYPE_STR("application/vnd.3gpp2.sms"),
> SIPTAG_PAYLOAD( &payload ), TAG_END() );
>   nua_handle_destroy(h);
>
> }
>
> So how can I generate a byte sequence where the first byte is zero and have
> it correctly determine the length of the payload?  Is there an example of a
> direct sip_payload_t .pl_data  memcpy or similar that I can get working ?

Probably there are, but all you have to do is to initialize pl_data
with data pointer and pl_len with its length.

--Pekka


-- 
Pekka.Pessi mail at nokia.com

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to