Dialogic 05-2239-009 User Manual

Page of 604
2. Insert a required IPPARM_MIME_PART parameter to point to the GC_PARM_BLK structure 
for the first MIME part in the message using the 
 function.
3. Repeat Step 2 for each additional MIME part, inserting the parameters in order of how the 
MIME parts should be organized in the message.
Set/send message data and clean up
After creating and populating the top-level GC_PARM_BLK structure that lists all the MIME parts 
to be sent in the SIP message, set or send the message and clean up the set-up structures:
1. Call 
 or 
 with a pointer to the top-level GC_PARM_BLK to 
set or send the MIME message data.
2. Delete all GC_PARM_BLK structures created during the set-up process after the Global Call 
function returns.
3. Optionally, free the application buffer holding the MIME part body data, since that data has 
been copied into the dedicated MIME buffer when the function was called. Or you can choose 
to not free the application buffer and instead reuse it for the next MIME part body.
Code Example
The following code example constructs a single part MIME message and uses the 
 
function to send it in an INVITE message. Note that the example uses the extended utility function 
 because the Content-Type and Content-Disposition header strings 
exceed 255 bytes.
#include "gclib.h"
.
.
.
GC_PARM_BLK *pParmBlockA = NULL;
GC_PARM_BLK *pParmBlockB = NULL;
char *pBodyType = "Content-Type: application/ISUP ;version=nxv3 ;base=etsi121;
userInput=12345678901234567890123456789012345678901234567890123456789012345678901234567890123456
789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
3456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
char *pBody = "01 00 49 00 00 03 02 00 07 04 10 00 33 63 21\r\n43 00 00 03 06 0d 03 80 90 a2 07 
03 10 03 63\r\n53 00 10 0a 07 03 10 27 80 88 03 00 00 89 8b\r\n0e 95 1e 1e 1e 06 26 05 0d f5 01 
06 10 04 00";
char *pPartHeader1 = "Content-Disposition: signal ;handling=optional;
userInput=12345678901234567890123456789012345678901234567890123456789012345678901234567890123456
789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
3456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
char *pPartHeader2 = "Content-User: Dialogic ;type=demo1";
/* Insert Content-Type field */
/* Add 1 to strlen for the NULL termination character */
gc_util_insert_parm_ref_ex(&pParmBlockB,
                           IPSET_MIME,
                           IPPARM_MIME_PART_TYPE,
                           (unsigned long)(strlen(pBodyType) + 1),
                           pBodyType);