Bladeren bron

- sip.instance parameter support by Nils Ohlmeier

Jan Janak 20 jaren geleden
bovenliggende
commit
9cda3be99a
5 gewijzigde bestanden met toevoegingen van 15 en 1 verwijderingen
  1. 2 0
      parser/contact/contact.c
  2. 1 0
      parser/contact/contact.h
  3. 8 0
      parser/parse_param.c
  4. 2 0
      parser/parse_param.h
  5. 2 1
      scripts/ser_mysql.sh

+ 2 - 0
parser/contact/contact.c

@@ -247,6 +247,7 @@ int parse_contacts(str* _s, contact_t** _c)
 			c->expires = hooks.contact.expires;
 			c->received = hooks.contact.received;
 			c->method = hooks.contact.method;
+			c->instance = hooks.contact.instance;
 
 			if (_s->len == 0) goto ok;
 		}
@@ -315,6 +316,7 @@ void print_contacts(FILE* _o, contact_t* _c)
 		fprintf(_o, "expires : %p\n", ptr->expires);
 		fprintf(_o, "received: %p\n", ptr->received);
 		fprintf(_o, "method  : %p\n", ptr->method);
+		fprintf(_o, "instance: %p\n", ptr->instance);
 		fprintf(_o, "len     : %d\n", ptr->len);
 		if (ptr->params) {
 			print_params(_o, ptr->params);

+ 1 - 0
parser/contact/contact.h

@@ -50,6 +50,7 @@ typedef struct contact {
 	param_t* expires;       /* expires parameter hook */
 	param_t* method;        /* method parameter hook */
 	param_t* received;      /* received parameter hook */
+	param_t* instance;      /* sip.instance parameter hook */
 	param_t* params;        /* List of all parameters */
 	int len;                /* Total length of the element */
         struct contact* next; /* Next contact in the list */

+ 8 - 0
parser/parse_param.c

@@ -89,6 +89,13 @@ static inline void parse_contact_class(param_hooks_t* _h, param_t* _p)
 			_h->contact.received = _p;
 		}
 		break;
+	case '+':
+		if ((_p->name.len == 13) &&
+			(!strncasecmp(_p->name.s + 1, "sip.instance", 12))) {
+			_p->type = P_INSTANCE;
+			_h->contact.instance = _p;
+		}
+		break;
 	}
 }
 
@@ -491,6 +498,7 @@ static inline void print_param(FILE* _o, param_t* _p)
 	case P_RECEIVED:  type = "P_RECEIVED";  break;
 	case P_DSTIP:     type = "P_DSTIP";     break;
 	case P_DSTPORT:   type = "P_DSTPORT";   break;
+	case P_INSTANCE:  type = "P_INSTANCE";  break;
 	default:          type = "UNKNOWN";     break;
 	}
 	

+ 2 - 0
parser/parse_param.h

@@ -55,6 +55,7 @@ typedef enum ptype {
 	P_TTL,       /* URI: ttl parameter */
 	P_DSTIP,     /* URI: dstip parameter */
 	P_DSTPORT,   /* URi: dstport parameter */
+	P_INSTANCE,  /* Contact: sip.instance parameter */
 } ptype_t;
 
 
@@ -88,6 +89,7 @@ struct contact_hooks {
 	struct param* q;        /* q parameter */
 	struct param* method;   /* method parameter */
 	struct param* received; /* received parameter */
+	struct param* instance; /* sip.instance parameter */
 };
 
 

+ 2 - 1
scripts/ser_mysql.sh

@@ -240,7 +240,7 @@ INSERT INTO version VALUES ( 'reserved', '1');
 INSERT INTO version VALUES ( 'phonebook', '1');
 INSERT INTO version VALUES ( 'pending', '4');
 INSERT INTO version VALUES ( 'missed_calls', '2');
-INSERT INTO version VALUES ( 'location', '6');
+INSERT INTO version VALUES ( 'location', '7');
 INSERT INTO version VALUES ( 'grp', '2');
 INSERT INTO version VALUES ( 'event', '1');
 INSERT INTO version VALUES ( 'aliases', '6');
@@ -387,6 +387,7 @@ CREATE TABLE location (
   state tinyint(1) unsigned NOT NULL default '0',
   flags int(11) NOT NULL default '0',
   user_agent varchar(50) NOT NULL default '',
+  instance varchar(80) NOT NULL default '',
   PRIMARY KEY($USERCOL, domain, contact)
 ) $TABLE_TYPE;