Ignore:
Timestamp:
Feb 13, 2013 10:19:25 AM (11 years ago)
Author:
nanang
Message:

Close #1614: Added call redirect option PJSIP_REDIRECT_ACCEPT_REPLACE to accept call redirection with replaced 'To' header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c

    r4323 r4347  
    23302330    switch (op) { 
    23312331    case PJSIP_REDIRECT_ACCEPT: 
     2332    case PJSIP_REDIRECT_ACCEPT_REPLACE: 
    23322333    case PJSIP_REDIRECT_STOP: 
    23332334        /* Must increment session counter, that's the convention of the  
     
    23952396    switch (op) { 
    23962397    case PJSIP_REDIRECT_ACCEPT: 
     2398    case PJSIP_REDIRECT_ACCEPT_REPLACE: 
    23972399        /* User accept the redirection. Reset the session and resend the  
    23982400         * INVITE request. 
     
    24192421                  pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); 
    24202422            via->branch_param.slen = 0; 
     2423 
     2424            /* Process PJSIP_REDIRECT_ACCEPT_REPLACE */ 
     2425            if (op == PJSIP_REDIRECT_ACCEPT_REPLACE) { 
     2426                pjsip_to_hdr *to; 
     2427                pjsip_dialog *dlg = inv->dlg; 
     2428                enum { TMP_LEN = 128 }; 
     2429                char tmp[TMP_LEN]; 
     2430                int len; 
     2431 
     2432                /* Replace To header */ 
     2433                to = PJSIP_MSG_TO_HDR(tdata->msg); 
     2434                to->uri = (pjsip_uri*) 
     2435                          pjsip_uri_clone(tdata->pool, 
     2436                                          dlg->target_set.current->uri); 
     2437                to->tag.slen = 0; 
     2438                pj_list_init(&to->other_param); 
     2439                 
     2440                /* Re-init dialog remote info */ 
     2441                dlg->remote.info = (pjsip_to_hdr*) 
     2442                                   pjsip_hdr_clone(dlg->pool, to); 
     2443 
     2444                /* Remove header param from remote info */ 
     2445                if (PJSIP_URI_SCHEME_IS_SIP(dlg->remote.info->uri) || 
     2446                    PJSIP_URI_SCHEME_IS_SIPS(dlg->remote.info->uri)) 
     2447                { 
     2448                    pjsip_sip_uri *sip_uri = (pjsip_sip_uri *)  
     2449                                   pjsip_uri_get_uri(dlg->remote.info->uri); 
     2450                    if (!pj_list_empty(&sip_uri->header_param)) { 
     2451                        /* Remove all header param */ 
     2452                        pj_list_init(&sip_uri->header_param); 
     2453                    } 
     2454                } 
     2455 
     2456                /* Print the remote info. */ 
     2457                len = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, 
     2458                                      dlg->remote.info->uri, tmp, TMP_LEN); 
     2459                if (len < 1) { 
     2460                    pj_ansi_strcpy(tmp, "<-error: uri too long->"); 
     2461                    len = pj_ansi_strlen(tmp); 
     2462                } 
     2463                pj_strdup2_with_null(dlg->pool, &dlg->remote.info_str, tmp); 
     2464 
     2465                /* Secure? */ 
     2466                dlg->secure = PJSIP_URI_SCHEME_IS_SIPS(to->uri); 
     2467            } 
    24212468 
    24222469            /* Reset message destination info (see #1248). */ 
Note: See TracChangeset for help on using the changeset viewer.