ChallyCai / doubango

Automatically exported from code.google.com/p/doubango
0 stars 1 forks source link

SIP OPTIONS capabilities headers not being added correctly. #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Below code snippet breaks the addCaps method in low-level Doubango SWIG API and 
causes OPTIONS to be missing an important 'Contact: ' header. addCaps should 
append the 'capabilities' to the 'Contact: ' header but since it's not there 
due to the code below, it creates multiple lines of 'Accept-Contact: ' 
headers...

The code section that needs to be checked is here. To fix it for OPTIONS, I 
simply commented out and took the lower default behavior to get a 'Contact: ' 
header and manually create an 'Accept-Contact: ' header.

tsip_dialog.c - Line 175 (code snippet):

    switch(request->line.request.request_type){
        case tsip_MESSAGE:
        case tsip_PUBLISH:
        case tsip_BYE:
        case tsip_OPTIONS:
            {
                if(request->line.request.request_type == tsip_PUBLISH) {
                    TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_EXPIRES_VA_ARGS(TSK_TIME_MS_2_S(self->expires)));
                }
                /* add caps in Accept-Contact headers */
                tsk_list_foreach(item, self->ss->caps) {
                    const tsk_param_t* param = TSK_PARAM(item->data);
                    char* value = tsk_null;
                    tsk_sprintf(&value, "*;%s%s%s", 
                        param->name,
                        param->value ? "=" : "",
                        param->value ? param->value : "");
                    if(value) {
                        TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_DUMMY_VA_ARGS("Accept-Contact", value));
                        TSK_FREE(value);
                    }
                }
                break;
            }

Original issue reported on code.google.com by rich.ho...@gmail.com on 19 May 2011 at 3:46

GoogleCodeExporter commented 9 years ago
I should be more clear. OPTIONS headers should be created exactly like INVITE 
headers. The comment /* add caps in Accept-Contact headers */ is incorrect or 
not specified for SIP OPTIONS dialog. Add caps 'may' be appended to 'Contact: ' 
header per RFC 3840 section 8. 

Original comment by rich.ho...@gmail.com on 19 May 2011 at 3:53

GoogleCodeExporter commented 9 years ago
Should be fixed in r586

Original comment by boss...@yahoo.fr on 19 May 2011 at 3:43