コード例 #1
0
ファイル: release_call.c プロジェクト: asyn/openvims
/**
 * Alters the saved dlg_t routes for the dialog by removing
 * @param d - the dialog to modify the Record-Routes
 * @param dir - the direction
 */
void alter_dialog_route_set(dlg_t *d,enum p_dialog_direction dir,enum release_call_situation situation)
{
	rr_t *r;
	rr_t *r_new;
		
	str p; /*this is going to point to the scscf uri*/
		
		
	

	switch (dir) {
		case DLG_MOBILE_ORIGINATING:
			p = pcscf_record_route_mo_uri;
			
			break;
		case DLG_MOBILE_TERMINATING:
			p = pcscf_record_route_mt_uri;
	
			break;
		default:
			return;
	}
	d->route_set=revert_route(d->route_set);
		
	//LOG(L_CRIT,"Looking for <%.*s> in\n",p.len,p.s);
	//for(r=d->route_set;r!=NULL;r=r->next) 
		//LOG(L_CRIT,"<%.*s>\n",r->nameaddr.uri.len,r->nameaddr.uri.s);
	
		
	for(r=d->route_set;r!=NULL;r=r->next) {
		if (r->nameaddr.uri.len>=p.len && 
			strncasecmp(r->nameaddr.uri.s,p.s,r->nameaddr.uri.len)==0)
			{
				r_new=r->next;
				r->next=NULL;
				shm_free_rr(&d->route_set);
				d->route_set = r_new;
  	            return;
  	            
  	          	
  	            	
			}
				
	}
		
}		
コード例 #2
0
ファイル: dlg.c プロジェクト: AndreyRybkin/kamailio
/*
 * Create a copy of route set either in normal or reverse order
 */
static inline int get_route_set(struct sip_msg* _m, rr_t** _rs, unsigned char _order)
{
	struct hdr_field* ptr;
	rr_t* last, *p, *t;
	
	last = 0;

	ptr = _m->record_route;
	while(ptr) {
		if (ptr->type == HDR_RECORDROUTE_T) {
			if (parse_rr(ptr) < 0) {
				LOG(L_ERR, "get_route_set(): Error while parsing Record-Route body\n");
				goto error;
			}

			p = (rr_t*)ptr->parsed;
			if (shm_duplicate_rr(&t, p) < 0) {
				LOG(L_ERR, "get_route_set(): Error while duplicating rr_t\n");
				goto error;
			}
			if (!*_rs) *_rs = t;
			if (last) last->next = t;
			last = t;
			while (last->next) last = last->next; /* !!! there may be more routes in one hdr field !!! */

		}
		ptr = ptr->next;
	}
	if ((*_rs) && (_order != NORMAL_ORDER)) {
		/* better to revert the route outside of cycle above */
		*_rs = revert_route(*_rs);
	}
	
	return 0;

 error:
	shm_free_rr(_rs);
	return -1;
}