[asterisk-commits] rizzo: branch rizzo/astobj2 r48858 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Dec 22 03:43:32 MST 2006


Author: rizzo
Date: Fri Dec 22 04:43:31 2006
New Revision: 48858

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48858
Log:
add some comment on things to do namely:
- remove a duplicated block in handling autocreatepeer;

- suggestions on how to support multiple instance of a peer;


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=48858&r1=48857&r2=48858
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Dec 22 04:43:31 2006
@@ -498,6 +498,21 @@
 #ifndef DEFAULT_USERAGENT
 #define DEFAULT_USERAGENT "Asterisk PBX"	/*!< Default Useragent: header unless re-defined in sip.conf */
 #endif
+
+/*!
+ * Data structure linkage is shown below
+
+       [== sip_user ==]
+ 
+
+       [== sip_pvt ==]      <-------------------+-----<----------------+
+                                                |                      |
+                                                |                      |
+                               [  ...        ]--+     [   ...       ]--+
+       [ packets     ]-------->[== sip_pkt ==]------->[== sip_pkt ==]------ ...
+
+
+ */
 
 
 /* Default setttings are used as a channel setting and as a default when
@@ -1545,7 +1560,6 @@
 static void sip_destroy_user(struct sip_user *user);
 static int sip_poke_peer(struct sip_peer *peer);
 static void set_peer_defaults(struct sip_peer *peer);
-static struct sip_peer *temp_peer(const char *name);
 static void register_peer_exten(struct sip_peer *peer, int onoff);
 static struct sip_peer *find_peer(const char *peer, struct sockaddr_in *sin, int realtime);
 static struct sip_user *find_user(const char *name, int realtime);
@@ -8136,6 +8150,13 @@
 		strsep(&curi, ";");	/* This is Header options, not URI options */
 	curi = get_in_brackets(contact);
 
+	/* XXX
+	 * in case of multiple peers with the same credentials, we should find the
+	 * right entry in the database. curi is possibly one way, the other one
+	 * is maybe looking up the ip-port pair, or callid, or something like that ?
+	 * Check the debug messages to find out.
+	 */
+
 	/* if they did not specify Contact: or Expires:, they are querying
 	   what we currently have stored as their contact address, so return
 	   it
@@ -8707,6 +8728,10 @@
 			} 
 		}
 	}
+	/* XXX can avoid duplication and mistakes if this block is moved above.
+	 * create the peer, then manage it as a regular peer.
+	 * XXX aren't we missing a destruction on PARSE_REGISTER_FAILED ?
+	 */
 	if (!peer && autocreatepeer) {
 		/* Create peer if we have autocreate mode enabled */
 		peer = temp_peer(name);
@@ -15946,6 +15971,7 @@
 		return NULL;
 	}
 
+	/* is it ext at host or just host/ext ? */
 	ast_copy_string(tmp, dest, sizeof(tmp));
 	host = strchr(tmp, '@');
 	if (host) {
@@ -16479,6 +16505,7 @@
 	peer->prefs = default_prefs;
 }
 
+/* XXX this can be used to support multiple peers with same credentials. */
 /*! \brief Create temporary peer (used in autocreatepeer mode) */
 static struct sip_peer *temp_peer(const char *name)
 {



More information about the asterisk-commits mailing list