Browse code

- added new event type EVENT_DIALOG_SLA - BLA feature reuses the event type "dialog" but adds the "sla" parameter. As this parameter changes the typical SIP behavior massively (totally weird SIP semantics change) it is better to introduce a new parameter for the BLA feature. This fixes problems with "normal" dialog events. backported from opensips, (c) Anca

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4789 689a6050-402a-0410-94f2-e92a70836424

Klaus Darilion authored on 01/09/2008 11:32:36
Showing 3 changed files
... ...
@@ -756,7 +756,7 @@ db_query:
756 756
 			
757 757
 			/* if event BLA - check if sender is the same as contact */
758 758
 			/* if so, send an empty dialog info document */
759
-			if( event->evp->parsed == EVENT_DIALOG && contact )
759
+			if( event->evp->parsed == EVENT_DIALOG_SLA && contact )
760 760
 			{
761 761
 				sender.s = (char*)row_vals[sender_col].val.string_val;
762 762
 				if(sender.s== NULL || strlen(sender.s)==0)
... ...
@@ -416,7 +416,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
416 416
 		if (result->n > 0)
417 417
 		{
418 418
 
419
-			if(presentity->event->evp->parsed == EVENT_DIALOG)
419
+			if(presentity->event->evp->parsed == EVENT_DIALOG_SLA)
420 420
 			{
421 421
 				/* analize if previous body has a dialog */
422 422
 				row = &result->rows[0];
... ...
@@ -499,7 +499,7 @@ after_dialog_check:
499 499
 			n_update_cols= 0;
500 500
 			/* if event dialog and is_dialog -> if sender not the same as
501 501
 			 * old sender do not overwrite */
502
-			if( (presentity->event->evp->parsed == EVENT_DIALOG) &&  bla_update_publish==0)
502
+			if( (presentity->event->evp->parsed == EVENT_DIALOG_SLA) &&  bla_update_publish==0)
503 503
 			{
504 504
 				LM_DBG("drop Publish for BLA from a different sender that"
505 505
 						" wants to overwrite an existing dialog\n");
... ...
@@ -545,7 +545,7 @@ int handle_subscribe(struct sip_msg* msg, char* str1, char* str2)
545 545
 	/* getting presentity uri from Request-URI if initial subscribe - or else from database*/
546 546
 	if(to_tag_gen)
547 547
 	{
548
-		if(parsed_event->parsed!= EVENT_DIALOG)
548
+		if(parsed_event->parsed!= EVENT_DIALOG_SLA)
549 549
 		{
550 550
 			if( parse_sip_msg_uri(msg)< 0)
551 551
 			{
... ...
@@ -660,7 +660,7 @@ int handle_subscribe(struct sip_msg* msg, char* str1, char* str2)
660 660
 	if(reason.s)
661 661
 		pkg_free(reason.s);
662 662
 	
663
-//	if(parsed_event->parsed!= EVENT_DIALOG && subs.pres_uri.s)
663
+//	if(parsed_event->parsed!= EVENT_DIALOG_SLA && subs.pres_uri.s)
664 664
 		pkg_free(subs.pres_uri.s);
665 665
 	
666 666
 	if((!server_address.s) || (server_address.len== 0))
... ...
@@ -692,7 +692,7 @@ error:
692 692
 		}
693 693
 	}
694 694
 
695
-//  if(parsed_event->parsed!= EVENT_DIALOG &&subs.pres_uri.s)
695
+//  if(parsed_event->parsed!= EVENT_DIALOG_SLA &&subs.pres_uri.s)
696 696
 	if(subs.pres_uri.s)	
697 697
 		pkg_free(subs.pres_uri.s);
698 698
 	
... ...
@@ -888,7 +888,7 @@ int extract_sdialog_info(subs_t* subs,struct sip_msg* msg, int mexp, int* to_tag
888 888
 	LM_DBG("subs->contact= %.*s - len = %d\n",subs->contact.len,
889 889
 			subs->contact.s, subs->contact.len);	
890 890
 
891
-    if(subs->event->evp->parsed== EVENT_DIALOG)
891
+    if(subs->event->evp->parsed== EVENT_DIALOG_SLA)
892 892
     {
893 893
         /* user_contact@from_domain */
894 894
         if(parse_uri(subs->contact.s, subs->contact.len, &uri)< 0)
... ...
@@ -997,7 +997,7 @@ int get_stored_info(struct sip_msg* msg, subs_t* subs, int* reply_code,
997 997
 	{
998 998
 		lock_get(&subs_htable[i].lock);
999 999
 		s= search_shtable(subs_htable, subs->callid,subs->to_tag,subs->from_tag, i);
1000
-		if(s && s->event->evp->parsed!= EVENT_DIALOG)
1000
+		if(s && s->event->evp->parsed!= EVENT_DIALOG_SLA)
1001 1001
 		{
1002 1002
 			pres_uri.s= (char*)pkg_malloc(s->pres_uri.len* sizeof(char));
1003 1003
 			if(pres_uri.s== NULL)
... ...
@@ -1029,7 +1029,7 @@ found_rec:
1029 1029
 	
1030 1030
 	LM_DBG("Record found in hash_table\n");
1031 1031
 	
1032
-	if(s->event->evp->parsed!= EVENT_DIALOG)
1032
+	if(s->event->evp->parsed!= EVENT_DIALOG_SLA)
1033 1033
 		subs->pres_uri= pres_uri;
1034 1034
 	
1035 1035
 	subs->version = s->version;
... ...
@@ -1230,7 +1230,7 @@ int get_database_info(struct sip_msg* msg, subs_t* subs, int* reply_code, str* r
1230 1230
 	subs->local_cseq= row_vals[local_cseq_col].val.int_val;
1231 1231
 	subs->version= row_vals[version_col].val.int_val;
1232 1232
 
1233
-	if(subs->event->evp->parsed!= EVENT_DIALOG)
1233
+	if(subs->event->evp->parsed!= EVENT_DIALOG_SLA)
1234 1234
 	{
1235 1235
 		pres_uri.s= (char*)row_vals[pres_uri_col].val.string_val;
1236 1236
 		pres_uri.len= strlen(pres_uri.s);