/// <summary> /// InProgress --> (401/407/421/494) --> InProgress /// </summary> /// <param name="parameters"></param> /// <returns></returns> private Boolean InProgress_2_InProgress_X_401_407_421_494(params Object[] parameters) { TSIP_Response response = parameters[1] as TSIP_Response; Boolean ret; if (!(ret = base.UpdateWithResponse(response))) { /* alert the user */ TSIP_EventRegister.Signal(mUnRegsitering ? TSIP_EventRegister.tsip_register_event_type_t.AO_UNREGISTER : TSIP_EventRegister.tsip_register_event_type_t.AO_REGISTER, base.SipSession, response.StatusCode, response.ReasonPhrase, response); /* set last error (or info) */ base.SetLastError((short)response.StatusCode, response.ReasonPhrase, response); return(ret); } /* Ensure IPSec SAs */ //if (TSIP_DIALOG_GET_STACK(self)->security.secagree_mech && tsk_striequals(TSIP_DIALOG_GET_STACK(self)->security.secagree_mech, "ipsec-3gpp")) //{ // tsip_transport_ensureTempSAs(TSIP_DIALOG_GET_STACK(self)->layer_transport, response, TSIP_DIALOG(self)->expires); //} return(this.SendRegister(false)); }
/// <summary> /// InProgress -> (2xx) -> Terminated /// </summary> /// <param name="parameters"></param> /// <returns></returns> private Boolean InProgress_2_Terminated_X_2xx(params Object[] parameters) { TSIP_Response response = parameters[1] as TSIP_Response; /* Alert the user */ TSIP_EventRegister.Signal(TSIP_EventRegister.tsip_register_event_type_t.AO_UNREGISTER, base.SipSession, response.StatusCode, response.ReasonPhrase, response); return(true); }
/// <summary> /// InProgress -> (1xx) -> InProgress /// </summary> /// <param name="parameters"></param> /// <returns></returns> private Boolean InProgress_2_InProgress_X_1xx(params Object[] parameters) { TSIP_Response response = parameters[1] as TSIP_Response; /* Alert the user (session) */ TSIP_EventRegister.Signal(TSIP_EventRegister.tsip_register_event_type_t.AO_REGISTER, base.SipSession, response.StatusCode, response.ReasonPhrase, response); return(base.UpdateWithResponse(response)); }
/// <summary> /// InProgress -> (300-699) -> Terminated /// </summary> /// <param name="parameters"></param> /// <returns></returns> private Boolean InProgress_2_Terminated_X_300_to_699(params Object[] parameters) { TSIP_Response response = parameters[1] as TSIP_Response; base.SetLastError((short)response.StatusCode, response.ReasonPhrase, response); /* alert the user */ TSIP_EventRegister.Signal(mUnRegsitering ? TSIP_EventRegister.tsip_register_event_type_t.AO_UNREGISTER : TSIP_EventRegister.tsip_register_event_type_t.AO_REGISTER, base.SipSession, response.StatusCode, response.ReasonPhrase, response); return(true); }
/// <summary> /// Any -> (error) -> Terminated /// </summary> /// <param name="parameters"></param> /// <returns></returns> private Boolean Any_2_Terminated_X_Error(params Object[] parameters) { TSIP_Response response = parameters[2] as TSIP_Response; if (response != null) { base.SetLastError((short)response.StatusCode, response.ReasonPhrase, response); TSIP_EventRegister.Signal(mUnRegsitering ? TSIP_EventRegister.tsip_register_event_type_t.AO_UNREGISTER : TSIP_EventRegister.tsip_register_event_type_t.AO_REGISTER, base.SipSession, response.StatusCode, response.ReasonPhrase, response); } else { TSIP_EventDialog.Signal(TSIP_EventDialog.tsip_dialog_event_type_t.GlobalError, base.SipSession, "Global error", null); } return(false); }
/// <summary> /// InProgress -> (2xx) -> Connected /// </summary> /// <param name="parameters"></param> /// <returns></returns> private Boolean InProgress_2_Connected_X_2xx(params Object[] parameters) { Boolean ret = true; TSIP_Response response = parameters[1] as TSIP_Response; Boolean first_time_to_connect = base.State == tsip_dialog_state_t.Initial; /* - Set P-associated-uriS * - Update service-routes * - Update Pats */ { int index; // const tsip_header_Path_t *hdr_Path; // const tsip_header_Service_Route_t *hdr_Service_Route; // const tsip_header_P_Associated_URI_t *hdr_P_Associated_URI_t; TSIP_Uri uri; /* To avoid memory leaks ==> delete all concerned objects (it worth nothing) */ //TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->associated_uris); //TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->service_routes); //TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->paths); /* Associated URIs */ /*for(index = 0; (hdr_P_Associated_URI_t = (const tsip_header_P_Associated_URI_t*)tsip_message_get_headerAt(response, tsip_htype_P_Associated_URI, index)); index++){ * if(!TSIP_DIALOG_GET_STACK(self)->associated_uris){ * TSIP_DIALOG_GET_STACK(self)->associated_uris = tsk_list_create(); * } * uri = tsk_object_ref(hdr_P_Associated_URI_t->uri); * tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->associated_uris, (void**)&uri); * }*/ /* Service-Route (3GPP TS 24.229) * store the list of service route values contained in the Service-Route header field and bind the list to the contact * address used in registration, in order to build a proper preloaded Route header field value for new dialogs and * standalone transactions when using the respective contact address. */ /*for(index = 0; (hdr_Service_Route = (const tsip_header_Service_Route_t*)tsip_message_get_headerAt(response, tsip_htype_Service_Route, index)); index++){ * if(!TSIP_DIALOG_GET_STACK(self)->service_routes){ * TSIP_DIALOG_GET_STACK(self)->service_routes = tsk_list_create(); * } * uri = tsk_object_ref(hdr_Service_Route->uri); * tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->service_routes, (void**)&uri); * }*/ /* Paths */ /*for(index = 0; (hdr_Path = (const tsip_header_Path_t*)tsip_message_get_headerAt(response, tsip_htype_Path, index)); index++){ * if(TSIP_DIALOG_GET_STACK(self)->paths == 0){ * TSIP_DIALOG_GET_STACK(self)->paths = tsk_list_create(); * } * uri = tsk_object_ref(hdr_Path->uri); * tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->paths, (void**)&uri); * }*/ } /* 3GPP TS 24.229 - 5.1.1.2 Initial registration */ if (first_time_to_connect) { Boolean barred = true; //const tsk_list_item_t *item; //const tsip_uri_t *uri; //const tsip_uri_t *uri_first = 0; /* * b) store as the default public user identity the first URI on the list of URIs present in the P-Associated-URI header * field and bind it to the respective contact address of the UE and the associated set of security associations or TLS * session; * NOTE 4: When using the respective contact address and associated set of security associations or TLS session, the * UE can utilize additional URIs contained in the P-Associated-URI header field and bound it to the * respective contact address of the UE and the associated set of security associations or TLS session, e.g. for * application purposes. * c) treat the identity under registration as a barred public user identity, if it is not included in the P-Associated-URI * header field; */ //tsk_list_foreach(item, TSIP_DIALOG_GET_STACK(self)->associated_uris){ // uri = item->data; // if(item == TSIP_DIALOG_GET_STACK(self)->associated_uris->head){ // uri_first = item->data; // } // if(!tsk_object_cmp(TSIP_DIALOG_GET_STACK(self)->identity.preferred, uri)){ // barred = 0; // break; // } //} //if(barred && uri_first){ // TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->identity.preferred); // TSIP_DIALOG_GET_STACK(self)->identity.preferred = tsk_object_ref((void*)uri_first); //} } /* Update the dialog state */ if (!(ret = this.UpdateWithResponse(response))) { return(ret); } /* Reset current action */ base.CurrentAction = null; /* Request timeout for dialog refresh (re-registration). */ this.TimerRefresh.Period = (UInt64)base.GetNewDelay(response); this.TimerRefresh.Start(); /* Alert the user (session) */ TSIP_EventRegister.Signal(TSIP_EventRegister.tsip_register_event_type_t.AO_REGISTER, base.SipSession, response.StatusCode, response.ReasonPhrase, response); /* Alert the user (dialog) */ if (first_time_to_connect) { TSIP_EventDialog.Signal(TSIP_EventDialog.tsip_dialog_event_type_t.Connected, base.SipSession, response.ReasonPhrase, response); } return(ret); }