浏览代码

modules/usrloc: use 6th param to set the contact path

Victor Seva 12 年之前
父节点
当前提交
ad0e5daa88
共有 4 个文件被更改,包括 24 次插入17 次删除
  1. 2 2
      modules/usrloc/README
  2. 2 4
      modules/usrloc/doc/usrloc_admin.xml
  3. 5 3
      modules/usrloc/ul_mi.c
  4. 15 8
      modules/usrloc/ul_rpc.c

+ 2 - 2
modules/usrloc/README

@@ -814,7 +814,7 @@ modparam("usrloc", "db_ops_ruid", 1)
      * contact - contact string to be added
      * expires - expires value of the contact
      * Q - Q value of the contact
-     * unused - unused attribute (kept for backword compatibility)
+     * path value of the contact
      * flags - internal USRLOC flags of the contact
      * cflags - per branch flags of the contact
      * methods - mask with supported requests of the contact
@@ -887,7 +887,7 @@ modparam("usrloc", "db_ops_ruid", 1)
      * contact - contact string to be added
      * expires - expires value of the contact
      * Q - Q value of the contact
-     * unused - unused attribute (kept for backword compatibility)
+     * path value of the contact
      * flags - internal USRLOC flags of the contact
      * cflags - per branch flags of the contact
      * methods - mask with supported requests of the contact

+ 2 - 4
modules/usrloc/doc/usrloc_admin.xml

@@ -986,8 +986,7 @@ modparam("usrloc", "db_ops_ruid", 1)
 				<emphasis>Q</emphasis> - Q value of the contact
 			</para></listitem>
 			<listitem><para>
-				<emphasis>unused</emphasis> - unused attribute (kept for
-				backword compatibility)
+				<emphasis>path</emphasis> value of the contact
 			</para></listitem>
 			<listitem><para>
 				<emphasis>flags</emphasis> - internal USRLOC flags of the 
@@ -1142,8 +1141,7 @@ modparam("usrloc", "db_ops_ruid", 1)
 				<emphasis>Q</emphasis> - Q value of the contact
 			</para></listitem>
 			<listitem><para>
-				<emphasis>unused</emphasis> - unused attribute (kept for
-				backword compatibility)
+				<emphasis>path</emphasis> value of the contact
 			</para></listitem>
 			<listitem><para>
 				<emphasis>flags</emphasis> - internal USRLOC flags of the

+ 5 - 3
modules/usrloc/ul_mi.c

@@ -491,8 +491,8 @@ struct mi_root* mi_usrloc_flush(struct mi_root *cmd, void *param)
  * \brief Add a new contact for an address of record
  * \param cmd mi_root containing the parameter
  * \param param not used
- * \note Expects 7 nodes: table name, AOR, contact, expires, Q,
- * useless - backward compatible, flags, cflags, methods
+ * \note Expects 9 nodes: table name, AOR, contact, expires, Q,
+ * path, flags, cflags, methods
  * \return mi_root with the result
  */
 struct mi_root* mi_usrloc_add(struct mi_root *cmd, void *param)
@@ -540,8 +540,10 @@ struct mi_root* mi_usrloc_add(struct mi_root *cmd, void *param)
 	if (str2q( &ci.q, node->value.s, node->value.len) < 0)
 		goto bad_syntax;
 
-	/* unused value (param 6) FIXME */
+	/* path value (param 6) */
 	node = node->next;
+	if(strncmp(node->value.s, "0", 1) != 0 && node->value.len > 1)
+		ci.path = &node->value;
 
 	/* flags value (param 7) */
 	node = node->next;

+ 15 - 8
modules/usrloc/ul_rpc.c

@@ -524,14 +524,15 @@ static const char* ul_rpc_flush_doc[2] = {
 /*!
  * \brief Add a new contact for an address of record
  * \note Expects 9 parameters: table name, AOR, contact, expires, Q,
- * useless - backward compatible, flags, cflags, methods
+ * path, flags, cflags, methods
  */
 static void ul_rpc_add(rpc_t* rpc, void* ctx)
 {
 	str table = {0, 0};
 	str aor = {0, 0};
 	str contact = {0, 0};
-	str useless = {0, 0};
+	str path = {0, 0};
+	str temp = {0, 0};
 	double dtemp;
 	ucontact_info_t ci;
 	urecord_t* r;
@@ -541,18 +542,24 @@ static void ul_rpc_add(rpc_t* rpc, void* ctx)
 
 	memset( &ci, 0, sizeof(ucontact_info_t));
 
-	ret = rpc->scan(ctx, "SSSdf.Sddd", &table, &aor, &contact, &ci.expires,
-		&dtemp, &useless, &ci.flags, &ci.cflags, &ci.methods);
-	LM_DBG("ret: %d table:%.*s aor:%.*s contact:%.*s expires:%d dtemp:%f useless:%.*s flags:%d bflags:%d methods:%d\n",
+	ret = rpc->scan(ctx, "SSSdfSddd", &table, &aor, &contact, &ci.expires,
+		&dtemp, &path, &ci.flags, &ci.cflags, &ci.methods);
+	if(path.len==1 && (strncmp(temp.s, "0", 1)==0))	{
+		LM_DBG("path == 0 -> unset\n");
+	}
+	else {
+		ci.path = &path;
+	}
+	LM_DBG("ret: %d table:%.*s aor:%.*s contact:%.*s expires:%d dtemp:%f path:%.*s flags:%d bflags:%d methods:%d\n",
 		ret, table.len, table.s, aor.len, aor.s, contact.len, contact.s,
-		(int) ci.expires, dtemp, useless.len, useless.s, ci.flags, ci.cflags, (int) ci.methods);
+		(int) ci.expires, dtemp, ci.path->len, ci.path->s, ci.flags, ci.cflags, (int) ci.methods);
 	if ( ret != 9) {
 		rpc->fault(ctx, 500, "Not enough parameters or wrong format");
 		return;
 	}
 	ci.q = double2q(dtemp);
-	useless.s = q2str(ci.q, (unsigned int*)&useless.len);
-	LM_DBG("q:%.*s\n", useless.len, useless.s);
+	temp.s = q2str(ci.q, (unsigned int*)&temp.len);
+	LM_DBG("q:%.*s\n", temp.len, temp.s);
 	/* look for table */
 	dom = rpc_find_domain( &table );
 	if (dom == NULL) {