Example #1
0
void add_dlg_data_to_contact(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params) {
    
    struct impu_data *impu_data;
    impurecord_t* implicit_impurecord = 0;
    struct ucontact* ucontact;
    str callid = {0, 0};
    str path = {0, 0};
    
    LM_DBG("dialog [%p] confirmed, lets add dlg data to contact\n", dlg);
    
    if(_params && _params->param){
	impu_data = (struct impu_data*)*_params->param;
	if (!impu_data) {
		LM_ERR("IMPU data object is NULL...... aborting\n");
		return;
	}
	
	LM_DBG("IMPU data is present, contact: <%.*s> identity <%.*s>", impu_data->contact.len, impu_data->contact.s, impu_data->identity.len, impu_data->identity.s);
	LM_DBG("IMPU data domain <%.*s>", impu_data->d->name->len, impu_data->d->name->s);
	
	ul.lock_udomain(impu_data->d, &impu_data->identity);
	if (ul.get_impurecord(impu_data->d, &impu_data->identity, &implicit_impurecord) != 0) {
	    LM_DBG("usrloc does not have imprecord for implicity IMPU, ignore\n");
	}else {
	    if (ul.get_ucontact(implicit_impurecord, &impu_data->contact, &callid, &path, 0/*cseq*/,  &ucontact) != 0) { //contact does not exist
		LM_DBG("This contact: <%.*s> is not in usrloc, ignore - NOTE: You need S-CSCF usrloc set to match_mode CONTACT_PORT_IP_ONLY\n", impu_data->contact.len, impu_data->contact.s);
	    } else {//contact exists so add dialog data to it
		ul.add_dialog_data_to_contact(ucontact, dlg->h_entry, dlg->h_id);
	    }
	}
	ul.unlock_udomain(impu_data->d, &impu_data->identity);
    }
} 
Example #2
0
void remove_dlg_data_from_contact(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params) {
        
    struct impu_data *impu_data;
    impurecord_t* implicit_impurecord = 0;
    struct ucontact* ucontact;
    str callid = {0, 0};
    str path = {0, 0};
    udomain_t* domain_t;
    
    LM_DBG("dialog [%p] terminated, lets remove dlg data from contact\n", dlg);
    
    if (ul.register_udomain(domain, &domain_t) < 0) {
	    LM_ERR("Unable to register usrloc domain....aborting\n");
	    return;
    }
    
    if(_params && _params->param){
	impu_data = (struct impu_data*)*_params->param;
	if (!impu_data) {
		LM_ERR("IMPU data object is NULL...... aborting\n");
		return;
	}
	
	LM_DBG("IMPU data is present, contact: <%.*s> identity <%.*s>", impu_data->contact.len, impu_data->contact.s, impu_data->identity.len, impu_data->identity.s);
	LM_DBG("IMPU data domain <%.*s>", domain_t->name->len, domain_t->name->s);
	
	ul.lock_udomain(domain_t, &impu_data->identity);
	if (ul.get_impurecord(domain_t, &impu_data->identity, &implicit_impurecord) != 0) {
	    LM_DBG("usrloc does not have imprecord for implicity IMPU, ignore\n");
	}else {
	    if (ul.get_ucontact(&impu_data->contact, &callid, &path, 0/*cseq*/,  &ucontact) != 0) { //contact does not exist
		LM_DBG("This contact: <%.*s> is not in usrloc, ignore - NOTE: You need S-CSCF usrloc set to match_mode CONTACT_PORT_IP_ONLY\n", impu_data->contact.len, impu_data->contact.s);
	    } else {//contact exists so add dialog data to it
		ul.remove_dialog_data_from_contact(ucontact, dlg->h_entry, dlg->h_id);
		ul.release_ucontact(ucontact);
	    }
	}
	ul.unlock_udomain(domain_t, &impu_data->identity);
	free_impu_data(impu_data);
    }
    
    //we referenced the dialog when we registered for callbacks on it...
    dlgb.release_dlg(dlg);
}