예제 #1
0
void ims_pm_diameter_request(AAAMessage *msg)
{	
	if (!msg) return;
	switch(msg->applicationId){
    	case IMS_Cx:
			switch(msg->commandCode){				
				case IMS_UAR:														
					IMS_PM_LOG11(UR_AttUAR,Cx_get_session_id(msg),msg->endtoendId);
					return ;
					break;
				case IMS_LIR:														
					IMS_PM_LOG11(LIQ_AttLIR,Cx_get_session_id(msg),msg->endtoendId);
					return ;
					break;
			}
	}	
}
예제 #2
0
int ims_pm_pre_script(struct sip_msg *msg,void *param)
{
	str method={0,0};

	if (msg->first_line.type == SIP_REQUEST){		
		method = msg->first_line.u.request.method;	
		if (method.len==s_invite.len && strncasecmp(method.s,s_invite.s,s_invite.len)==0){
			/* INVITE */
			IMS_PM_LOG11(SC_AttSession,cscf_get_call_id(msg,0),cscf_get_cseq(msg,0));
			IMS_PM_LOG21(IC_AttSessionFromOtherNtwkDmn,cscf_get_call_id(msg,0),
				cscf_get_asserted_identity_domain(msg),
				cscf_get_cseq(msg,0));
			IMS_PM_LOG21(IC_AttSessionToOtherNtwkDmn,cscf_get_call_id(msg,0),
				cscf_get_realm_from_ruri(msg),
				cscf_get_cseq(msg,0));			
		}else{
			/* Other requests */
			IMS_PM_LOG21(OTHER_Att,cscf_get_call_id(msg,0),method,cscf_get_cseq(msg,0));
		}						
	}else{
		unsigned int code = msg->first_line.u.reply.statuscode;
		method = cscf_get_cseq_method(msg,0);
		if (method.len==s_invite.len && strncasecmp(method.s,s_invite.s,s_invite.len)==0){
			/* INVITE response */
			if (code<300) IMS_PM_LOG12(SC_SuccSession,cscf_get_call_id(msg,0),cscf_get_cseq(msg,0),code);
			else if (code>=300) {
				IMS_PM_LOG12(SC_FailSession,cscf_get_call_id(msg,0),cscf_get_cseq(msg,0),code);
				if (code==403) {
					IMS_PM_LOG22(IC_403SessionFromOtherNtwkDmn,cscf_get_call_id(msg,0),
						cscf_get_asserted_identity_domain(msg),cscf_get_cseq(msg,0),code);
					IMS_PM_LOG22(IC_403SessionToOtherNtwkDmn,cscf_get_call_id(msg,0),
						cscf_get_realm_from_ruri(msg),cscf_get_cseq(msg,0),code);
				}										
			}			
		}else{	
			/* Other responses */
			if (code>=200 && code<300) IMS_PM_LOG22(OTHER_Succ,cscf_get_call_id(msg,0),method,cscf_get_cseq(msg,0),code);
			else if (code>=300)	IMS_PM_LOG22(OTHER_Fail,cscf_get_call_id(msg,0),method,cscf_get_cseq(msg,0),code);
		}		
	}
	return 1;
}
예제 #3
0
파일: dlg_state.c 프로젝트: asyn/openvims
/**
 * The dialog timer looks for expired dialogs and removes them.
 * @param ticks - the current time
 * @param param - pointer to the dialogs list
 */
void dialog_timer(unsigned int ticks, void* param)
{
	p_dialog *d,*dn;
	int i;
	#ifdef WITH_IMS_PM
		int dialog_cnt[DLG_METHOD_MAX+1];
		for(i=0;i<=DLG_METHOD_MAX;i++)
			dialog_cnt[i]=0;
	#endif
	
	LOG(L_DBG,"DBG:"M_NAME":dialog_timer: Called at %d\n",ticks);
	if (!p_dialogs) p_dialogs = (p_dialog_hash_slot*)param;

	d_act_time();
	
	for(i=0;i<p_dialogs_hash_size;i++){
		d_lock(i);
			d = p_dialogs[i].head;
			while(d){
				dn = d->next;
				if (d->expires<=d_time_now) {						
						if (!terminate_p_dialog(d)) 
							del_p_dialog(d);					
				}
				#ifdef WITH_IMS_PM
					else dialog_cnt[d->method]++;
				#endif										
				d = dn;
			}
		d_unlock(i);
	}
	print_p_dialogs(L_INFO);
	#ifdef WITH_IMS_PM
		for(i=0;i<=DLG_METHOD_MAX;i++)
			IMS_PM_LOG11(RD_NbrDialogs,get_dialog_method_str(i),dialog_cnt[i]);		
	#endif	
}
예제 #4
0
/**
 * Creates a NOTIFY message and sends it
 * @param n - the r_notification to create the NOTIFY after
 */
void send_notification(r_notification *n)
{
	str h={0,0};
	int k=0;
#ifdef SER_MOD_INTERFACE
        uac_req_t req;
#endif
        
	LOG(L_DBG,"DBG:"M_NAME":send_notification: NOTIFY about <%.*s>\n",n->uri.len,n->uri.s);
	
	//tmb.print_dlg(stdout,n->dialog);
	
	h.len = 0;
	h.len += contact_hdr1.len + n->uri.len + contact_hdr2.len ;
	if (n->subscription_state.len) h.len += subss_hdr1.len + subss_hdr2.len + n->subscription_state.len;
	h.len+=event_hdr.len;
	h.len+=maxfwds_hdr.len;
	if (n->content_type.len) h.len += ctype_hdr1.len + ctype_hdr2.len + n->content_type.len;
	h.s = pkg_malloc(h.len);
	if (!h.s){
		LOG(L_ERR,"ERR:"M_NAME":send_notification: Error allocating %d bytes\n",h.len);
		h.len = 0;
	}

	h.len = 0;
	STR_APPEND(h,contact_hdr1);
	STR_APPEND(h,n->uri);
	STR_APPEND(h,contact_hdr2);

	STR_APPEND(h,event_hdr);
	STR_APPEND(h,maxfwds_hdr);
	if (n->subscription_state.len) {
		STR_APPEND(h,subss_hdr1);
		STR_APPEND(h,n->subscription_state);
		STR_APPEND(h,subss_hdr2);
	}
	if (n->content_type.len) {
		STR_APPEND(h,ctype_hdr1);
		STR_APPEND(h,n->content_type);
		STR_APPEND(h,ctype_hdr2);
	}
	
	//LOG(L_CRIT,"DLG:%p\n",n->dialog);
	#ifdef WITH_IMS_PM
		k = n->is_scscf_dereg;
	#endif 
	if (n->content.len)	{
#ifdef SER_MOD_INTERFACE
		set_uac_req(&req,
					&method,
					&h,
					&(n->content),
					n->dialog,
					TMCB_RESPONSE_IN|TMCB_ON_FAILURE|TMCB_LOCAL_COMPLETED,
					uac_request_cb,
					(void*)k);
		tmb.t_request_within(&req);
#else	
		tmb.t_request_within(&method, &h, &(n->content), n->dialog, uac_request_cb, (void*)k);
#endif		
	} else { 
#ifdef SER_MOD_INTERFACE
		set_uac_req(&req,
					&method,
					0,
					&(n->content),
					n->dialog,
					TMCB_RESPONSE_IN|TMCB_ON_FAILURE|TMCB_LOCAL_COMPLETED,
					uac_request_cb,
					(void*)k);
		tmb.t_request_within(&req);
#else	
		tmb.t_request_within(&method, &h, 0, n->dialog, uac_request_cb, (void*)k);
#endif		
	}
	if (h.s) pkg_free(h.s);
	
	#ifdef WITH_IMS_PM
		if (n->is_scscf_dereg) IMS_PM_LOG11(UR_AttDeRegCscf,n->dialog->id.call_id,n->dialog->loc_seq.value);
	#endif 
}