2010/3/12 Trevor Nunes <trevor.nu...@gmail.com>: > 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 ? Yes, you are correct - you need to use the tag macro SIPTAG_PAYLOAD() with a pointer to initialized sip_payload_t structure as its argument. For example, 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 ); sip_payload_t pl = SIP_PAYLOAD_INIT(); pl.pl_data = payload; pl.pl_len = sizeof 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(&pl), TAG_END() ); nua_handle_destroy(h); -- 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