Changeset 3385


Ignore:
Timestamp:
Dec 2, 2010 11:21:01 AM (13 years ago)
Author:
bennylp
Message:

Misc (re #1151): respond incoming re-INVITE with 491 instead of 500 if we are waiting for response for our outgoing re-INVITE. If we are currently processing another incoming re-INVITE, then respond with 500, as it is now

File:
1 edited

Legend:

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

    r3383 r3385  
    3434#include <pj/os.h> 
    3535#include <pj/log.h> 
     36#include <pj/rand.h> 
    3637 
    3738/*  
     
    39173918            /* Check if we have INVITE pending. */ 
    39183919            if (inv->invite_tsx && inv->invite_tsx!=tsx) { 
     3920                int code; 
    39193921                pj_str_t reason; 
    39203922 
    39213923                reason = pj_str("Another INVITE transaction in progress"); 
    39223924 
     3925                if (inv->invite_tsx->role == PJSIP_ROLE_UAC) 
     3926                    code = 491; 
     3927                else 
     3928                    code = 500; 
     3929 
    39233930                /* Can not receive re-INVITE while another one is pending. */ 
    3924                 status = pjsip_dlg_create_response( inv->dlg, rdata, 500,  
     3931                status = pjsip_dlg_create_response( inv->dlg, rdata, code, 
    39253932                                                    &reason, &tdata); 
    39263933                if (status != PJ_SUCCESS) 
    39273934                    return; 
     3935 
     3936                if (code == 500) { 
     3937                    /* MUST include Retry-After header with random value 
     3938                     * between 0-10. 
     3939                     */ 
     3940                    pjsip_retry_after_hdr *ra_hdr; 
     3941                    int val = (pj_rand() % 10); 
     3942 
     3943                    ra_hdr = pjsip_retry_after_hdr_create(tdata->pool, val); 
     3944                    pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)ra_hdr); 
     3945                } 
    39283946 
    39293947                status = pjsip_dlg_send_response( inv->dlg, tsx, tdata); 
Note: See TracChangeset for help on using the changeset viewer.