Commit 83a93477 authored by pintar's avatar pintar
Browse files

- sending of SUBSCRIPTION and awaiting of NOTIFICATION have to be optional and...

- sending of SUBSCRIPTION and awaiting of NOTIFICATION have to be optional and PX_SIP_SUBSCRIPTION and PX_SIP_NOTIFICATION are used to trigger this procedure
- f_setHeaders_deREGISTER: empty vc_authorization header is set for correct REGISTER message, vc_branch have to be rand calculated again
- f_removeRegistration: vc_via is replaced with vc_via_REG to use correct global variable
- f_calculateCredentials* functions: upper/lower case problem within algorithm parameter value is handled due to received values from response 

- new TODOs: temp solution for 2nd option of deREGISTRATION which have to be replaced with commented 1st solution which is more general(see f_setHeaders_deREGISTER and f_removeRegistration functions) Solution done to have progress with validation. 
parent 1c2169da
Loading
Loading
Loading
Loading
+62 −27
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ group ParameterOperations {
		  { id := "nonce", paramValue := v_nonce },
		  { id := "uri", paramValue := v_uri },
		  { id := "response", paramValue := v_response },
		  { id := "algorithm=md5", paramValue := omit }, // algorithm is not enclosed to " characters
		  { id := "algorithm="&v_algorithm, paramValue := omit }, // algorithm is not enclosed to " characters
		  { id := "cnonce", paramValue := v_cnonce },
		  { id := "opaque", paramValue := v_opaque }, // already enclosed to " characters
		  { id := "qop="&v_qop, paramValue := omit },//qop
@@ -276,7 +276,7 @@ group ParameterOperations {
		  { id := "nonce", paramValue := v_nonce },
		  { id := "uri", paramValue := v_uri },
//		  { id := "response", paramValue := v_response }, // not included to cause an error
		  { id := "algorithm=md5", paramValue := omit }, // algorithm is not enclosed to " characters
		  { id := "algorithm="&v_algorithm, paramValue := omit }, // algorithm is not enclosed to " characters
		  { id := "cnonce", paramValue := v_cnonce },
		  { id := "opaque=""""", paramValue := omit }, // already enclosed to " characters
		  { id := "qop="&v_qop, paramValue := omit },//qop
@@ -420,7 +420,7 @@ group ParameterOperations {
		 { id := "nonce", paramValue := v_nonce },
		 { id := "uri", paramValue := v_uri },
		 { id := "response", paramValue := v_response },
		 { id := "algorithm=md5", paramValue := omit }, // algorithm is not enclosed to " characters
		 { id := "algorithm="&v_algorithm, paramValue := omit }, // algorithm is not enclosed to " characters
		 { id := "cnonce", paramValue := v_cnonce },
		 { id := "opaque=""""", paramValue := omit }, // already enclosed to " characters
		 { id := "qop="&v_qop, paramValue := omit },//qop
@@ -1248,11 +1248,29 @@ group SetHeaders {
            fromParams := v_params
    	};
    	
    	vc_contact := 
    		{
    		  fieldName := CONTACT_E,
    		  contactBody := {wildcard := "*" } 
        vc_via_REG :={
          fieldName := VIA_E,
          viaBody 	 := {valueof(m_ViaBody_currIpaddr(vc_branch, vc_userprofile))}
        };
    	
    	//set of empty authorization header to avoid setting of different values of nonce count and response
        vc_authorization := 
        {
          fieldName := AUTHORIZATION_E,
          body := {f_calculatecCredentials_empty(vc_userprofile)}
        }
    	
    	//TODO: delete 2nd solution of deregistration when other is working
        vc_contact.contactBody.contactAddresses[0].contactParams := {{"expires","0"}};
//    	TODO: 1st solution of deRegistration: Cancelation of Registration due to RFC3665/2.4
//    	vc_contact := 
//    		{
//    		  fieldName := CONTACT_E,
//    		  contactBody := {wildcard := "*" } 
//    		};



	} // end function f_setHeaders_deREGISTER


@@ -3719,8 +3737,12 @@ group Registration {
	  if (PX_SIP_REGISTRATION)
	  {
		f_setHeaders_deREGISTER(p_cSeq);
		v_request := m_REGISTER_Request_expires(vc_requestUri, vc_callIdReg,
		p_cSeq,  vc_from, vc_to, vc_via, vc_contact, vc_authorization, "0");
//TODO: 1st option
//		v_request := m_REGISTER_Request_expires(vc_requestUri, vc_callIdReg,
//		p_cSeq,  vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization, "0");
//TODO: 2nd option
        v_request := m_REGISTER_Request_Base(vc_requestUri, vc_callIdReg,
        p_cSeq,  vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);
		//v_request.msgHeader.route := f_route();
		
		f_SendREGISTER(v_request);
@@ -3736,8 +3758,12 @@ group Registration {
				  tc_resp.stop;
				  // set headers via, cseq and authorization
				  f_setHeaders_2ndREGISTER(p_cSeq);
					v_request := m_REGISTER_Request_expires(vc_requestUri, vc_callIdReg,
					p_cSeq,  vc_from, vc_to, vc_via, vc_contact, vc_authorization, "0");
//                TODO: 1st option
//					v_request := m_REGISTER_Request_expires(vc_requestUri, vc_callIdReg,
//					p_cSeq,  vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization, "0");
//                  TODO: 2nd option
                    v_request := m_REGISTER_Request_Base(vc_requestUri, vc_callIdReg,
                    p_cSeq,  vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);
					//v_request.msgHeader.route := f_route();
				  // Re-send protected REGISTER
				  f_SendREGISTER(v_request);//LibSip
@@ -3788,6 +3814,8 @@ group Registration {
		 * @param p_subscribe	subscribe template
		 */
		function f_Subscription(inout CSeq p_cSeq_s,template SUBSCRIBE_Request p_subscribe) runs on SipComponent
		{
          if (PX_SIP_SUBSCRIPTION)
          {
    		  //f_setHeaders_SUBSCRIBE(p_cSeq_s);
    		  //send SUBSCRIBE
@@ -3797,6 +3825,7 @@ group Registration {
    		  
    		  //await NOTIFY and send reply 200 OK
    		  f_awaitingNOTIFY_sendReply(mw_NOTIFY_Request_Base(vc_callId));
          }
	  
		}//end function f_Subscription

@@ -3808,15 +3837,21 @@ group Registration {
		 * @param p_notify		notify template
		 */
		function f_SubscriptionWithNotification(inout CSeq p_cSeq_s, template SUBSCRIBE_Request p_subscribe, template NOTIFY_Request p_notify) runs on SipComponent
		{
		  if (PX_SIP_SUBSCRIPTION)
		  {
    		  f_setHeaders_SUBSCRIBE(p_cSeq_s);
    		  //send SUBSCRIBE
    		  f_SendSUBSCRIBE(p_subscribe);
    		  // awaiting 200 OK SUBSCRIBE
    		  f_awaitingOkResponse(p_cSeq_s);
		  }
		  
		  if(PX_SIP_NOTIFICATION)
		  {
    		  //await NOTIFY and send reply 200 OK
    		  f_awaitingNOTIFY_sendReply(p_notify);
		  }
	  
		}//end function f_Subscription