The problem is I can send any type of content I want as long as the first
byte is not 0x00 ... If this byte is 0x00 it will send a 0 byte SIP message
out. So for example here is a short message that works perfectly, If I
change the payload[0] = 0x02 line to payload[0] = 0x00 an empty Content
Length is generated ...
--
nua_handle_t *h;
static int lastSequenceNum = -1;
char payload[5];
payload[0] = 0x02;
payload[1] = 0x07;
payload[2] = 0x01;
payload[3] = gMOSMS_seqnum << 2;
payload[4] = '\0';
printf("smsagent: Sending L2-ACK with seq: %d \n", gMOSMS_seqnum );
if( lastSequenceNum == gMOSMS_seqnum)
{
printf("smsagent: duplicate seq: %d \n", gMOSMS_seqnum );
}
// send_3ggp2_sms(nua, payload );
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_STR( payload ), TAG_END() );
nua_handle_destroy(h);
--
I guess I need to use a different macro that doesn't treat the payload as a
string or initialize an empty SIP message and cast the pl_data pointer to my
new message ? Should I just malloc() a bunch of bytes and assign this to
pl_data and set pl_en even so I'm still using the SIPTAG_PAYLOAD_STR()
macro so is there way of creating a nua_message where it will treat the
pl_data not as a string ?
thanks for replying!
Trev.
On Fri, Mar 12, 2010 at 11:36 AM, Pekka Pessi <ppe...@gmail.com> wrote:
> 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® 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