Browse code

- sip.instance parameter support by Nils Ohlmeier

Jan Janak authored on 02/09/2005 10:36:15
Showing 5 changed files
... ...
@@ -247,6 +247,7 @@ int parse_contacts(str* _s, contact_t** _c)
247 247
 			c->expires = hooks.contact.expires;
248 248
 			c->received = hooks.contact.received;
249 249
 			c->method = hooks.contact.method;
250
+			c->instance = hooks.contact.instance;
250 251
 
251 252
 			if (_s->len == 0) goto ok;
252 253
 		}
... ...
@@ -315,6 +316,7 @@ void print_contacts(FILE* _o, contact_t* _c)
315 316
 		fprintf(_o, "expires : %p\n", ptr->expires);
316 317
 		fprintf(_o, "received: %p\n", ptr->received);
317 318
 		fprintf(_o, "method  : %p\n", ptr->method);
319
+		fprintf(_o, "instance: %p\n", ptr->instance);
318 320
 		fprintf(_o, "len     : %d\n", ptr->len);
319 321
 		if (ptr->params) {
320 322
 			print_params(_o, ptr->params);
... ...
@@ -50,6 +50,7 @@ typedef struct contact {
50 50
 	param_t* expires;       /* expires parameter hook */
51 51
 	param_t* method;        /* method parameter hook */
52 52
 	param_t* received;      /* received parameter hook */
53
+	param_t* instance;      /* sip.instance parameter hook */
53 54
 	param_t* params;        /* List of all parameters */
54 55
 	int len;                /* Total length of the element */
55 56
         struct contact* next; /* Next contact in the list */
... ...
@@ -89,6 +89,13 @@ static inline void parse_contact_class(param_hooks_t* _h, param_t* _p)
89 89
 			_h->contact.received = _p;
90 90
 		}
91 91
 		break;
92
+	case '+':
93
+		if ((_p->name.len == 13) &&
94
+			(!strncasecmp(_p->name.s + 1, "sip.instance", 12))) {
95
+			_p->type = P_INSTANCE;
96
+			_h->contact.instance = _p;
97
+		}
98
+		break;
92 99
 	}
93 100
 }
94 101
 
... ...
@@ -491,6 +498,7 @@ static inline void print_param(FILE* _o, param_t* _p)
491 498
 	case P_RECEIVED:  type = "P_RECEIVED";  break;
492 499
 	case P_DSTIP:     type = "P_DSTIP";     break;
493 500
 	case P_DSTPORT:   type = "P_DSTPORT";   break;
501
+	case P_INSTANCE:  type = "P_INSTANCE";  break;
494 502
 	default:          type = "UNKNOWN";     break;
495 503
 	}
496 504
 	
... ...
@@ -55,6 +55,7 @@ typedef enum ptype {
55 55
 	P_TTL,       /* URI: ttl parameter */
56 56
 	P_DSTIP,     /* URI: dstip parameter */
57 57
 	P_DSTPORT,   /* URi: dstport parameter */
58
+	P_INSTANCE,  /* Contact: sip.instance parameter */
58 59
 } ptype_t;
59 60
 
60 61
 
... ...
@@ -88,6 +89,7 @@ struct contact_hooks {
88 89
 	struct param* q;        /* q parameter */
89 90
 	struct param* method;   /* method parameter */
90 91
 	struct param* received; /* received parameter */
92
+	struct param* instance; /* sip.instance parameter */
91 93
 };
92 94
 
93 95
 
... ...
@@ -240,7 +240,7 @@ INSERT INTO version VALUES ( 'reserved', '1');
240 240
 INSERT INTO version VALUES ( 'phonebook', '1');
241 241
 INSERT INTO version VALUES ( 'pending', '4');
242 242
 INSERT INTO version VALUES ( 'missed_calls', '2');
243
-INSERT INTO version VALUES ( 'location', '6');
243
+INSERT INTO version VALUES ( 'location', '7');
244 244
 INSERT INTO version VALUES ( 'grp', '2');
245 245
 INSERT INTO version VALUES ( 'event', '1');
246 246
 INSERT INTO version VALUES ( 'aliases', '6');
... ...
@@ -387,6 +387,7 @@ CREATE TABLE location (
387 387
   state tinyint(1) unsigned NOT NULL default '0',
388 388
   flags int(11) NOT NULL default '0',
389 389
   user_agent varchar(50) NOT NULL default '',
390
+  instance varchar(80) NOT NULL default '',
390 391
   PRIMARY KEY($USERCOL, domain, contact)
391 392
 ) $TABLE_TYPE;
392 393