[svn-commits] oej: branch oej/libmidcom-new r48311 - in /team/oej/libmidcom-new: ./ midcom/...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Dec 6 01:25:23 MST 2006


Author: oej
Date: Wed Dec  6 02:25:22 2006
New Revision: 48311

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48311
Log:
Formatting changes, adding comments

Modified:
    team/oej/libmidcom-new/Makefile
    team/oej/libmidcom-new/midcom/Makefile
    team/oej/libmidcom-new/res_netsec.c
    team/oej/libmidcom-new/timer/Makefile

Modified: team/oej/libmidcom-new/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/libmidcom-new/Makefile?view=diff&rev=48311&r1=48310&r2=48311
==============================================================================
--- team/oej/libmidcom-new/Makefile (original)
+++ team/oej/libmidcom-new/Makefile Wed Dec  6 02:25:22 2006
@@ -62,7 +62,7 @@
 STAT_LIBRARY=res_netsec.a
 DYN_LIBRARY=res_netsec.so
 
-SUBDIRS=midcom timer
+#SUBDIRS=midcom timer
 
 all: subdirs $(STAT_LIBRARY) $(DYN_LIBRARY)
 

Modified: team/oej/libmidcom-new/midcom/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/libmidcom-new/midcom/Makefile?view=diff&rev=48311&r1=48310&r2=48311
==============================================================================
--- team/oej/libmidcom-new/midcom/Makefile (original)
+++ team/oej/libmidcom-new/midcom/Makefile Wed Dec  6 02:25:22 2006
@@ -74,7 +74,8 @@
 
 # Compilation flags
 CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes #-Werror
-SOFLAGS = -Wl,-hlibmidcom.so.1
+#SOFLAGS = -Wl ,-hlibmidcom.so.1
+SOFLAGS = -Wl,-dynamic -bundle -force_flat_namespace -undefined suppress
 LDCONFIG_FLAGS+=-n
 
 # AR flags
@@ -121,7 +122,8 @@
 	ranlib $(STATIC_LIBRARY)
 
 $(DYNAMIC_LIBRARY) : $(DYNAMIC_OBJS)
-	$(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
+	#$(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
+	$(CC) $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
 	$(LDCONFIG) $(LDCONFIG_FLAGS) .
 	ln -sf libmidcom.so.1 libmidcom.so
 

Modified: team/oej/libmidcom-new/res_netsec.c
URL: http://svn.digium.com/view/asterisk/team/oej/libmidcom-new/res_netsec.c?view=diff&rev=48311&r1=48310&r2=48311
==============================================================================
--- team/oej/libmidcom-new/res_netsec.c (original)
+++ team/oej/libmidcom-new/res_netsec.c Wed Dec  6 02:25:22 2006
@@ -24,6 +24,14 @@
  * res_netsec.c -- Provides the MIDCOM services to Asterisk
  *
  * \author Srivatsa Chivukula <srivatsa at ranchnetworks.com>
+ *
+ * \todo
+ *  - Create registration in rtp.c for a remote RTP handler
+ *  - Make interface less SIP-specific (this can be used for
+ *    all RTP based channels - H.323, jingle, mgcp
+ *  - Clear up operations
+ *  - Make source code follow coding guidelines
+ *  - Check licensing
 */
 
 
@@ -80,44 +88,44 @@
 static void timer_context_delete(timer_task_context_t *ttc);
 
 static struct midcom_rule {
-  int enable_rtcp;
-  struct in_addr midbox_addr;
-  char username[256];
-  int nat_done;
-  int firewall_done;
-  int bye_done;
-  int novideo;
-  int con;
-  int ruleid;
-  struct sockaddr_in our_internal_addr;
-  struct sockaddr_in our_natted_addr;
-  struct sockaddr_in redirip_nat;       /* Peer NAT */
-  int vruleid;
-  struct sockaddr_in our_internal_vaddr;
-  struct sockaddr_in our_natted_vaddr;
-  struct sockaddr_in vredirip_nat;
-  void *channel;                   /* farend */
-  struct sockaddr_in remote_addr;  /* farend */
-  struct sockaddr_in remote_vaddr; /* farend */
-  int lifetime;
-  int is_cached;
-  int invalid;
-  timer_id_t timer_handle;
-  void *p;
-  struct midcom_rule *next;
+	int enable_rtcp;
+	struct in_addr midbox_addr;
+	char username[256];
+	int nat_done;
+	int firewall_done;
+	int bye_done;
+	int novideo;
+	int con;
+	int ruleid;
+	struct sockaddr_in our_internal_addr;
+	struct sockaddr_in our_natted_addr;
+	struct sockaddr_in redirip_nat;       /* Peer NAT */
+	int vruleid;
+	struct sockaddr_in our_internal_vaddr;
+	struct sockaddr_in our_natted_vaddr;
+	struct sockaddr_in vredirip_nat;
+	void *channel;                   /* farend */
+	struct sockaddr_in remote_addr;  /* farend */
+	struct sockaddr_in remote_vaddr; /* farend */
+	int lifetime;
+	int is_cached;
+	int invalid;
+	timer_id_t timer_handle;
+	void *p;
+	struct midcom_rule *next;
 } *midcom_rule_head = NULL;
 
 static struct connection {
-  struct in_addr ipaddress;
-  char name[256];
-  char username[256];
-  char password[256];
-  int tls;
-  int mode;
-  int sock;
-  int pingsock;
-  timer_id_t timer_handle;
-  struct connection *next;
+	struct in_addr ipaddress;
+	char name[256];
+	char username[256];
+	char password[256];
+	int tls;
+	int mode;
+	int sock;
+	int pingsock;
+	timer_id_t timer_handle;
+	struct connection *next;
 } *connl = NULL;
 	
 /* Protect the midcom rule list */
@@ -228,192 +236,200 @@
 
 static void midcom_sip_helper_register(struct ast_sip_helper_cb *cb)
 {
-  sip_cb = cb;
+	sip_cb = cb;
 }
 
 static void midcom_sip_helper_unregister(void)
 {
-  sip_cb = NULL;
+	sip_cb = NULL;
 }
 
 int load_module(void)
 {
-  if (midcom_config_reload()) {
-    ast_log(LOG_ERROR, "Unable to read conf file\n");
-    return -1;
-  }
-
-  fflush(stdout);
-  if (!mc_init(cert)) {
-    ast_log(LOG_ERROR, "Unable to initialize midcom\n");
-    return -1;
-  }
-
-  timer = timer_context_create();
-  if (!timer) {
-    ast_log(LOG_ERROR, "Unable to create (midcom) timer context\n");
-    mc_close();
-    return -1;
-  }
-
-  /* Register the sip hook functions */
-  midcom_cb = &sip_hook;
-
-  /* Register all CLI functions for midcom */
-  ast_cli_register_multiple(my_clis, sizeof(my_clis)/ sizeof(my_clis[0]));
-
-  midcom_connect_all();
-  return 0;
+	if (midcom_config_reload()) {
+		ast_log(LOG_ERROR, "Unable to read conf file. Not loading MIDCOM support\n");
+		return -1;
+	}
+
+	fflush(stdout);	/* XXXX Why is this needed ????? */
+	if (!mc_init(cert)) {
+		ast_log(LOG_ERROR, "Unable to initialize MIDCOM module\n");
+	/* We should possibly release some allocated memory here,
+	if we've allocated during config load */
+		return -1;
+	}
+
+	timer = timer_context_create();
+	if (!timer) {
+		ast_log(LOG_ERROR, "Unable to create (midcom) timer context\n");
+	/* We should possibly release some allocated memory here,
+	if we've allocated during config load */
+		mc_close();
+		return -1;
+	}
+
+	/* Register the sip hook functions */
+	/* OEJ: This needs to move so that two separate modules does not talk
+		directly. 
+		We can possibly set up a hook in rtp.c for midcom support.
+	*/
+	midcom_cb = &sip_hook;
+
+	/* Register all CLI functions for midcom */
+	ast_cli_register_multiple(my_clis, sizeof(my_clis)/ sizeof(my_clis[0]));
+
+	midcom_connect_all();
+	return 0;
 }
 
 int unload_module(void)
 {
-  struct midcom_rule *r;
-  struct connection *c;
-
-  if (!ast_mutex_lock(&mclock)) {
-    /* Hangup all interfaces if they have an owner */
-    r = midcom_rule_head;
-    while (r) {
-      if (sip_cb)
+	struct midcom_rule *r;
+	struct connection *c;
+
+	if (!ast_mutex_lock(&mclock)) {
+		/* Hangup all interfaces if they have an owner */
+		r = midcom_rule_head;
+		while (r) {
+		  if (sip_cb)
 	sip_cb->ast_softhangup_helper(r->p);
-      r = r->next;
-    }
-    midcom_rule_head = NULL;
-    ast_mutex_unlock(&mclock);
-  } else {
-    ast_log(LOG_WARNING, "Unable to lock the midcom rule list\n");
-  }
-
-  c = connl;
-  while (c) {
-    timer_cancel_tick(c, sizeof(struct connection));
-    mc_comm_disconnect(c->pingsock);
-    mc_comm_disconnect(c->sock);
-    c = c->next;
-  }
-  connl = NULL;
-
-  if (timer == NULL) {
-    timer_context_delete(timer);
-    timer = NULL;
-  }
-
-  /* Unregister the sip hook functions */
-  midcom_cb = NULL;
-
-  ast_cli_unregister_multiple(my_clis, sizeof(my_clis)/ sizeof(my_clis[0]));
-  mc_close();
-  return 0;
+		  r = r->next;
+		}
+		midcom_rule_head = NULL;
+		ast_mutex_unlock(&mclock);
+	} else {
+		ast_log(LOG_WARNING, "Unable to lock the midcom rule list\n");
+	}
+
+	c = connl;
+	while (c) {
+		timer_cancel_tick(c, sizeof(struct connection));
+		mc_comm_disconnect(c->pingsock);
+		mc_comm_disconnect(c->sock);
+		c = c->next;
+	}
+	connl = NULL;
+
+	if (timer == NULL) {
+		timer_context_delete(timer);
+		timer = NULL;
+	}
+
+	/* Unregister the sip hook functions */
+	midcom_cb = NULL;
+
+	ast_cli_unregister_multiple(my_clis, sizeof(my_clis)/ sizeof(my_clis[0]));
+	mc_close();
+	return 0;
 }
 
 int usecount()
 {
-  return usecnt;
+	return usecnt;
 }
 
 char *key()
 {
-  return ASTERISK_GPL_KEY;
+	return ASTERISK_GPL_KEY;
 }
 
 char *description()
 {
-  return (char *) desc;
+	return (char *) desc;
 }
 
 /*--- midcom_enable_firewall: Turn on Midcom firewall (CLI command) */
 static int midcom_enable_firewall(int fd, int argc, char *argv[])
 {
-  int oldflag = midcom_enabled;
-  if (argc != 3)
-    return RESULT_SHOWUSAGE;
-  midcom_enabled = 1;
-  if (oldflag)
-    ast_cli(fd, "SIP Midcom Firewalling re-enabled\n");
-  else
-    ast_cli(fd, "SIP Midcom Firewalling enabled\n");
-  return RESULT_SUCCESS;
+	int oldflag = midcom_enabled;
+	if (argc != 3)
+		return RESULT_SHOWUSAGE;
+	midcom_enabled = 1;
+	if (oldflag)
+		ast_cli(fd, "SIP Midcom Firewalling re-enabled\n");
+	else
+		ast_cli(fd, "SIP Midcom Firewalling enabled\n");
+	return RESULT_SUCCESS;
 }
 
 /*--- midcom_disable_firewall: Turn off Midcom firewall (CLI command) */
 static int midcom_disable_firewall(int fd, int argc, char *argv[])
 {
-  if (argc != 3)
-    return RESULT_SHOWUSAGE;
-  midcom_enabled = 0;
-  ast_cli(fd, "SIP Midcom Firewalling disabled\n");
-  return RESULT_SUCCESS;
+	if (argc != 3)
+		return RESULT_SHOWUSAGE;
+	midcom_enabled = 0;
+	ast_cli(fd, "SIP Midcom Firewalling disabled\n");
+	return RESULT_SUCCESS;
 }
 
 /*--- midcom_show_firewall: Show Midcom firewall rules (CLI command) */
 static int midcom_show_firewall(int fd, int argc, char *argv[])
 {
-  regex_t regexbuf;
-  int havepattern = 0;
+	regex_t regexbuf;
+	int havepattern = 0;
 
 #define FORMAT2 "%-15.15s  %-21.20s %-8s %-15.15s %-8s %-15.15s %-8s  %-5.5s %-10s\n"
 #define FORMAT  "%-15.15s  %-21.20s %-8d %-15.15s %-8d %-15.15s %-8d  %-5.5s %-10s\n"
 
-  struct midcom_rule *r = midcom_rule_head;
-  char name[256];
-  char iabuf1[INET_ADDRSTRLEN], iabuf2[INET_ADDRSTRLEN], iabuf3[INET_ADDRSTRLEN];
-  struct ast_channel *peer_chan;
-  struct midcom_rule *peer_rule;
-  struct sockaddr_in peer_ip;
-
-  switch (argc) {
-  case 5:
-    if (!strcasecmp(argv[3], "like")) {
-      if (regcomp(&regexbuf, argv[4], REG_EXTENDED | REG_NOSUB))
+	struct midcom_rule *r = midcom_rule_head;
+	char name[256];
+	char iabuf1[INET_ADDRSTRLEN], iabuf2[INET_ADDRSTRLEN], iabuf3[INET_ADDRSTRLEN];
+	struct ast_channel *peer_chan;
+	struct midcom_rule *peer_rule;
+	struct sockaddr_in peer_ip;
+
+	switch (argc) {
+	case 5:
+		if (!strcasecmp(argv[3], "like")) {
+		  if (regcomp(&regexbuf, argv[4], REG_EXTENDED | REG_NOSUB))
 		  return RESULT_SHOWUSAGE;
-      havepattern = 1;
-    } else
-      return RESULT_SHOWUSAGE;
-  case 3:
-    break;
-  default:
-    return RESULT_SHOWUSAGE;
-  }
-
-  ast_cli(fd, FORMAT2, "Username", "Originating Address", "Port", "Natted Address", "Port", "Peer Address", "Port", "Media", "Status");
+		  havepattern = 1;
+		} else
+		  return RESULT_SHOWUSAGE;
+	case 3:
+		break;
+	default:
+		return RESULT_SHOWUSAGE;
+	}
+
+	ast_cli(fd, FORMAT2, "Username", "Originating Address", "Port", "Natted Address", "Port", "Peer Address", "Port", "Media", "Status");
 	
-  for ( ; r ; r = r->next) {
-
-    char status[20] = "";
-
-    if (havepattern && regexec(&regexbuf, r->username, 0, NULL, 0)) {
-      continue;
-    }
-
-    strncpy(name, r->username, sizeof(name));
-    memset(&peer_ip, 0, sizeof(peer_ip));
-    peer_ip = r->redirip_nat;
-
-    if (r->firewall_done) {
-      if (is_nearend_nat())
+	for ( ; r ; r = r->next) {
+
+		char status[20] = "";
+
+		if (havepattern && regexec(&regexbuf, r->username, 0, NULL, 0)) {
+		  continue;
+		}
+
+		strncpy(name, r->username, sizeof(name));
+		memset(&peer_ip, 0, sizeof(peer_ip));
+		peer_ip = r->redirip_nat;
+
+		if (r->firewall_done) {
+		  if (is_nearend_nat())
 		  strncpy(status, "Firewalled", sizeof(status));
-      else if (is_farend_nat()) {
-
-               if (r->nat_done)
+		  else if (is_farend_nat()) {
+
+		           if (r->nat_done)
 		  strncpy(status, "Bridged", sizeof(status));
-               else
+		           else
 		  strncpy(status, "Firewalled", sizeof(status));
 
-                  peer_chan = sip_cb->ast_bridged_channel_helper(r->p);
-                  if (peer_chan && peer_chan->tech_pvt) {
+		              peer_chan = sip_cb->ast_bridged_channel_helper(r->p);
+		              if (peer_chan && peer_chan->tech_pvt) {
 			peer_rule = sip_cb->ast_get_hook_struct(peer_chan->tech_pvt);
 			if (peer_rule)
 				peer_ip = peer_rule->our_natted_addr;
 	          }
-      }
-    }
-    else if (r->nat_done)
-      strncpy(status, "Natted", sizeof(status));
-    else if (r->bye_done)
-      strncpy(status, "Deleted", sizeof(status));
-
-    ast_cli(fd, FORMAT, name, 
+		  }
+		}
+		else if (r->nat_done)
+		  strncpy(status, "Natted", sizeof(status));
+		else if (r->bye_done)
+		  strncpy(status, "Deleted", sizeof(status));
+
+		ast_cli(fd, FORMAT, name, 
 		r->our_internal_addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_internal_addr.sin_addr) : "(Unspecified)",
 		ntohs(r->our_internal_addr.sin_port),
 		r->our_natted_addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf2, sizeof(iabuf2), r->our_natted_addr.sin_addr) : "(Unspecified)",
@@ -422,10 +438,10 @@
 		ntohs(peer_ip.sin_port),
 		"Audio",
 		status);
-     if (!r->novideo) {
-
-       peer_ip = peer_rule->our_natted_vaddr;
-       ast_cli(fd, FORMAT, name, 
+		 if (!r->novideo) {
+
+		   peer_ip = peer_rule->our_natted_vaddr;
+		   ast_cli(fd, FORMAT, name, 
 		r->our_internal_vaddr.sin_addr.s_addr ? ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_internal_vaddr.sin_addr) : "(Unspecified)",
 		ntohs(r->our_internal_vaddr.sin_port),
 		r->our_natted_vaddr.sin_addr.s_addr ? ast_inet_ntoa(iabuf2, sizeof(iabuf2), r->our_natted_vaddr.sin_addr) : "(Unspecified)",
@@ -435,13 +451,13 @@
 		"Video",
 		status);
 
-     }
-  };
-
-  if (havepattern)
-    regfree(&regexbuf);
-
-  return RESULT_SUCCESS;
+		 }
+	};
+
+	if (havepattern)
+		regfree(&regexbuf);
+
+	return RESULT_SUCCESS;
 #undef FORMAT
 #undef FORMAT2
 }
@@ -452,10 +468,10 @@
 static int midcom_show_version(int fd, int argc, char *argv[])
 {
 
-  if (argc != 3)
-      return RESULT_SHOWUSAGE;
-  ast_cli(fd, "%s\n", version);
-  return RESULT_SUCCESS;
+	if (argc != 3)
+		  return RESULT_SHOWUSAGE;
+	ast_cli(fd, "%s\n", version);
+	return RESULT_SUCCESS;
 }
 
 
@@ -463,11 +479,11 @@
 static int midcom_enable_debug(int fd, int argc, char *argv[])
 {
 
-  if (argc != 2)
-      return RESULT_SHOWUSAGE;
-  debug_midbox = 1;
-  ast_cli(fd, "Debug printing enabled on MIDOCM\n");
-  return RESULT_SUCCESS;
+	if (argc != 2)
+		  return RESULT_SHOWUSAGE;
+	debug_midbox = 1;
+	ast_cli(fd, "Debug printing enabled on MIDOCM\n");
+	return RESULT_SUCCESS;
 }
 
 
@@ -475,47 +491,47 @@
 static int midcom_disable_debug(int fd, int argc, char *argv[])
 {
 
-  if (argc != 3)
-      return RESULT_SHOWUSAGE;
-  debug_midbox = 0;
-  ast_cli(fd, "Debug printing disabled on MIDOCM\n");
-  return RESULT_SUCCESS;
+	if (argc != 3)
+		  return RESULT_SHOWUSAGE;
+	debug_midbox = 0;
+	ast_cli(fd, "Debug printing disabled on MIDOCM\n");
+	return RESULT_SUCCESS;
 }
 
 
 
 static int midcom_config_reload(void)
 {
-  struct ast_config *cfg;
-  char *s;
-  char *cat;
-  char *utype;
-  struct connection *conn, *curr, *prev = NULL;
-  struct ast_variable *v;
-  int dupl = 0;
-  char iabuf[INET_ADDRSTRLEN];
-
-  cfg = ast_config_load(config);
-  if (cfg) {
-    if ((s = ast_variable_retrieve(cfg, "general", "midcomnat"))) {
-      if (!strcasecmp(s, "nearend"))
+	struct ast_config *cfg;
+	char *s;
+	char *cat;
+	char *utype;
+	struct connection *conn, *curr, *prev = NULL;
+	struct ast_variable *v;
+	int dupl = 0;
+	char iabuf[INET_ADDRSTRLEN];
+
+	cfg = ast_config_load(config);
+	if (cfg) {
+		if ((s = ast_variable_retrieve(cfg, "general", "midcomnat"))) {
+		  if (!strcasecmp(s, "nearend"))
 	midcomnat = NEAREND;
-      else if (!strcasecmp(s, "farend"))
+		  else if (!strcasecmp(s, "farend"))
 	midcomnat = FAREND;
-      else {
+		  else {
 	midcomnat = NO_MIDCOM;
 	midcom_enabled = 0;
-      }
-    }
-    if ((s = ast_variable_retrieve(cfg, "general", "certificate"))) {
-      ast_copy_string(cert, s, sizeof(cert));
-    }
-    if ((s = ast_variable_retrieve(cfg, "general", "lb"))) {
-    }
-
-    cat = ast_category_browse(cfg, NULL);
-    while (cat) {
-      if (strcasecmp(cat, "general")) {
+		  }
+		}
+		if ((s = ast_variable_retrieve(cfg, "general", "certificate"))) {
+		  ast_copy_string(cert, s, sizeof(cert));
+		}
+		if ((s = ast_variable_retrieve(cfg, "general", "lb"))) {
+		}
+
+		cat = ast_category_browse(cfg, NULL);
+		while (cat) {
+		  if (strcasecmp(cat, "general")) {
 	utype = ast_variable_retrieve(cfg, cat, "type");
 	if (utype) {
 	  if (!strcasecmp(utype, "midbox")) {
@@ -568,74 +584,74 @@
 	  }
 	} else
 	  ast_log(LOG_WARNING, "Section '%s' lacks type\n", cat);
-      }
-      cat = ast_category_browse(cfg, cat);
-    }
-    ast_config_destroy(cfg);
-  } else {
-    ast_log(LOG_NOTICE, "Unable to load config %s, MIDCOM disabled\n", config);
-    midcom_enabled = 0;
-    return -1;
-  }
-  
-  if (option_verbose > 1)
-    ast_verbose(VERBOSE_PREFIX_2 "Midcom Reloaded, %s NAT being used.\n", (midcomnat == 0)? "No": ((midcomnat == 1)? "Near-End": "Far-End"));
-
-  return 0;
+		  }
+		  cat = ast_category_browse(cfg, cat);
+		}
+		ast_config_destroy(cfg);
+	} else {
+		ast_log(LOG_NOTICE, "Unable to load config %s, MIDCOM disabled\n", config);
+		midcom_enabled = 0;
+		return -1;
+	}
+	
+	if (option_verbose > 1)
+		ast_verbose(VERBOSE_PREFIX_2 "Midcom Reloaded, %s NAT being used.\n", (midcomnat == 0)? "No": ((midcomnat == 1)? "Near-End": "Far-End"));
+
+	return 0;
 }
 
 static struct midcom_rule *midcom_rule_alloc(void *p)
 {
-  struct midcom_rule *r;
-  r = malloc(sizeof(struct midcom_rule));
-  if (r == NULL) {
-    ast_log(LOG_NOTICE, "Not enough resources\n");
-    return NULL;
-  }
-  memset(r, 0, sizeof(struct midcom_rule));
-  r->novideo = sip_cb->ast_get_flag_novideo(p);
-  sip_cb->ast_rtp_get_peer_audio_helper(p, &r->our_internal_addr);
-  if (!r->novideo)
-    sip_cb->ast_rtp_get_peer_video_helper(p, &r->our_internal_vaddr);
-  return r;
+	struct midcom_rule *r;
+	r = malloc(sizeof(struct midcom_rule));
+	if (r == NULL) {
+		ast_log(LOG_NOTICE, "Not enough resources\n");
+		return NULL;
+	}
+	memset(r, 0, sizeof(struct midcom_rule));
+	r->novideo = sip_cb->ast_get_flag_novideo(p);
+	sip_cb->ast_rtp_get_peer_audio_helper(p, &r->our_internal_addr);
+	if (!r->novideo)
+		sip_cb->ast_rtp_get_peer_video_helper(p, &r->our_internal_vaddr);
+	return r;
 }
 
 static int midcom_handle_request_invite_hook(void *p)
 {
-  struct sockaddr_in caller;
-  char iabuf[INET_ADDRSTRLEN];
-  struct midcom_rule *r = NULL;
-
-  if (!midcom_enabled) {
-    ast_log(LOG_ERROR, "Midcom: Module not enabled\n");
-    if (option_verbose > 1)
-      ast_verbose("Midcom: Module currently disabled\n");
-    return 1;
-  }
-
-  if (!sip_cb) {
-    ast_log(LOG_ERROR, "Midcom: Module not initialized properly\n");
-    if (option_verbose > 1)
-       ast_verbose("Midcom: Error!! - Module not initialized\n");
-    return 0;
-  }
-
-  if ((r = sip_cb->ast_get_hook_struct(p)))
-    return 1;
-
-  if (is_nearend_nat()) {
-    sip_cb->ast_rtp_get_peer_audio_helper(p, &caller);
-
-    if (sip_cb->ast_cmp_sa_addr(p, &caller)) { /* not forwarded from another softswitch */
-
-      r = midcom_rule_alloc(p);
-      if (r == NULL)
+	struct sockaddr_in caller;
+	char iabuf[INET_ADDRSTRLEN];
+	struct midcom_rule *r = NULL;
+
+	if (!midcom_enabled) {
+		ast_log(LOG_ERROR, "Midcom: Module not enabled\n");
+		if (option_verbose > 1)
+		  ast_verbose("Midcom: Module currently disabled\n");
+		return 1;
+	}
+
+	if (!sip_cb) {
+		ast_log(LOG_ERROR, "Midcom: Module not initialized properly\n");
+		if (option_verbose > 1)
+		   ast_verbose("Midcom: Error!! - Module not initialized\n");
+		return 0;
+	}
+
+	if ((r = sip_cb->ast_get_hook_struct(p)))
+		return 1;
+
+	if (is_nearend_nat()) {
+		sip_cb->ast_rtp_get_peer_audio_helper(p, &caller);
+
+		if (sip_cb->ast_cmp_sa_addr(p, &caller)) { /* not forwarded from another softswitch */
+
+		  r = midcom_rule_alloc(p);
+		  if (r == NULL)
 	return 0;
-      /* sip_cb->ast_get_recv_addr(p, &r->midbox_addr); */
-      if ( get_lb_midbox_ip(&r->midbox_addr) == -1)
+		  /* sip_cb->ast_get_recv_addr(p, &r->midbox_addr); */
+		  if ( get_lb_midbox_ip(&r->midbox_addr) == -1)
 	return 0;
-      
-      if (!r->nat_done) {
+		  
+		  if (!r->nat_done) {
 	if ((r->midbox_addr.s_addr) && (r->con = midcom_connect(r->midbox_addr, &r->lifetime, &r->is_cached)) != -1) {
 	  if (midcom_reserve_nat(r->con, &r->ruleid, &r->our_natted_addr, /*r->enable_rtcp*/ 1, &r->lifetime) != 0) {
 	    free(r);
@@ -654,73 +670,73 @@
 	  free(r);
 	  return 0;
 	}
-      }
-      
-      r->nat_done = 1;
-
-      ast_mutex_lock(&usecnt_lock);
-      usecnt++;
-      ast_mutex_unlock(&usecnt_lock);      
-      ast_update_use_count();
-
-      sip_cb->ast_map_hook_struct(p, (void *)r);
-      r->p = p;
-      r->next = midcom_rule_head;
-      midcom_rule_head = r;
-
-    } else {
-      /* The caller might be forwarded from another softswitch */;
-    }
-  }
-  else
-    {
-      /* farend */
-      r = NULL;
-    }
-  return 1;
+		  }
+		  
+		  r->nat_done = 1;
+
+		  ast_mutex_lock(&usecnt_lock);
+		  usecnt++;
+		  ast_mutex_unlock(&usecnt_lock);      
+		  ast_update_use_count();
+
+		  sip_cb->ast_map_hook_struct(p, (void *)r);
+		  r->p = p;
+		  r->next = midcom_rule_head;
+		  midcom_rule_head = r;
+
+		} else {
+		  /* The caller might be forwarded from another softswitch */;
+		}
+	}
+	else
+		{
+		  /* farend */
+		  r = NULL;
+		}
+	return 1;
 }
 
 static int midcom_handle_response_invite_hook(void *p)
 {
-  char iabuf[INET_ADDRSTRLEN];
-  struct midcom_rule *r = NULL;
-
-  if (!midcom_enabled) {
-    ast_log(LOG_ERROR, "Midcom: Module not enabled\n");
-    if (option_verbose > 1)
-       ast_verbose("Midcom: Module currently disabled\n");
-    return 1;
-  }
-
-  if (!sip_cb) {
-    ast_log(LOG_ERROR, "Midcom: Module not initialized properly\n");
-    if (option_verbose > 1)
-       ast_verbose("Midcom: Error!! - Module not initialized\n");
-    return 0;
-  }
-
-
-  if ((r = sip_cb->ast_get_hook_struct(p)))
-    return 1;
-
-  r = midcom_rule_alloc(p);
-  if (r == NULL)
-    return 0;
-  
-  if (!r->username[0])
-    strncpy(r->username, sip_cb->ast_get_username(p), 256);
-
-  if (option_verbose > 1)
-    ast_verbose("Midcom: Allocating new midcom rule for phone: %s\n", r->username);
-
-  
-  /* sip_cb->ast_get_recv_addr(p, &r->midbox_addr); */
-  if ( get_lb_midbox_ip(&r->midbox_addr) == -1)
+	char iabuf[INET_ADDRSTRLEN];
+	struct midcom_rule *r = NULL;
+
+	if (!midcom_enabled) {
+		ast_log(LOG_ERROR, "Midcom: Module not enabled\n");
+		if (option_verbose > 1)
+		   ast_verbose("Midcom: Module currently disabled\n");
+		return 1;
+	}
+
+	if (!sip_cb) {
+		ast_log(LOG_ERROR, "Midcom: Module not initialized properly\n");
+		if (option_verbose > 1)
+		   ast_verbose("Midcom: Error!! - Module not initialized\n");
+		return 0;
+	}
+
+
+	if ((r = sip_cb->ast_get_hook_struct(p)))
+		return 1;
+
+	r = midcom_rule_alloc(p);
+	if (r == NULL)
+		return 0;
+	
+	if (!r->username[0])
+		strncpy(r->username, sip_cb->ast_get_username(p), 256);
+
+	if (option_verbose > 1)
+		ast_verbose("Midcom: Allocating new midcom rule for phone: %s\n", r->username);
+
+	
+	/* sip_cb->ast_get_recv_addr(p, &r->midbox_addr); */
+	if ( get_lb_midbox_ip(&r->midbox_addr) == -1)
 	return 0;
 
-  if (is_nearend_nat())
-    {
-      if ((r->midbox_addr.s_addr) && (r->con = midcom_connect(r->midbox_addr, &r->lifetime, &r->is_cached)) != -1) {
+	if (is_nearend_nat())
+		{
+		  if ((r->midbox_addr.s_addr) && (r->con = midcom_connect(r->midbox_addr, &r->lifetime, &r->is_cached)) != -1) {
 	if (midcom_reserve_nat(r->con, &r->ruleid, &r->our_natted_addr, /*r->enable_rtcp*/ 1, &r->lifetime) != 0) {
 	  ast_log(LOG_NOTICE, "Failed to NAT user %s for audio\n", r->username);
 	  free(r);
@@ -736,22 +752,22 @@
 	}
 	
 	r->nat_done = 1;
-      
-      } else {
+		  
+		  } else {
 	ast_log(LOG_NOTICE, "Failed to connect to %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), r->midbox_addr));
 	free(r);
 	return 0;
-      }
-      
-    }
-  else 
-    {
-      /* farend */
-      struct sockaddr_in sin;
-      struct sockaddr_in vsin;
-      int codec = 0;
-
-      if ((r->midbox_addr.s_addr) && (r->con = midcom_connect(r->midbox_addr, &r->lifetime, &r->is_cached)) != -1) {
+		  }
+		  
+		}
+	else 
+		{
+		  /* farend */
+		  struct sockaddr_in sin;
+		  struct sockaddr_in vsin;
+		  int codec = 0;
+
+		  if ((r->midbox_addr.s_addr) && (r->con = midcom_connect(r->midbox_addr, &r->lifetime, &r->is_cached)) != -1) {
 	sip_cb->ast_rtp_get_us_audio_helper(p, &sin);
 	if (!r->novideo)
 	  sip_cb->ast_rtp_get_us_video_helper(p, &vsin);
@@ -774,68 +790,68 @@
 	midcom_disconnect(r->con, r->is_cached);
 	timer_setup_tick(r, sizeof(struct midcom_rule), r->lifetime, &r->timer_handle);
 
-      } else {
+		  } else {
 		  ast_log(LOG_NOTICE, "Failed to connect to %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), r->midbox_addr));
 		  free(r);
 		  return 0;
-      }
-    
-    }
-
-  ast_mutex_lock(&usecnt_lock);
-  usecnt++;
-  ast_mutex_unlock(&usecnt_lock);
-  ast_update_use_count();
-  
-  sip_cb->ast_map_hook_struct(p, (void *)r);
-  r->p = p;
-  r->next = midcom_rule_head;
-  midcom_rule_head = r;
-  
-  return 1;
+		  }
+		
+		}
+
+	ast_mutex_lock(&usecnt_lock);
+	usecnt++;
+	ast_mutex_unlock(&usecnt_lock);
+	ast_update_use_count();
+	
+	sip_cb->ast_map_hook_struct(p, (void *)r);
+	r->p = p;
+	r->next = midcom_rule_head;
+	midcom_rule_head = r;
+	
+	return 1;
 }
 
 static int midcom_transmit_response_with_sdp_hook(void *p)
 {
-  char iabuf[INET_ADDRSTRLEN];
-  struct midcom_rule *r = NULL;
-  struct sockaddr_in sin;
-  struct sockaddr_in vsin;
-  int codec = 0;
-
-  if (!midcom_enabled) {
-    ast_log(LOG_ERROR, "Midcom: Module not enabled\n");
-    if (option_verbose > 1)
-      ast_verbose("Midcom: Module currently disabled\n");
-    return 1;
-  }
-
-  if (!sip_cb) {
-    ast_log(LOG_ERROR, "Midcom: Module not initialized properly\n");
-    if (option_verbose > 1)
-       ast_verbose("Midcom: Error!! - Module not initialized\n");
-    return 0;
-  }
-
-  if ((r = sip_cb->ast_get_hook_struct(p)))
-    return 1;
-
-  if (is_farend_nat())
-    {
-      r = midcom_rule_alloc(p);
-      if (r == NULL)
+	char iabuf[INET_ADDRSTRLEN];
+	struct midcom_rule *r = NULL;
+	struct sockaddr_in sin;
+	struct sockaddr_in vsin;
+	int codec = 0;
+
+	if (!midcom_enabled) {
+		ast_log(LOG_ERROR, "Midcom: Module not enabled\n");
+		if (option_verbose > 1)
+		  ast_verbose("Midcom: Module currently disabled\n");
+		return 1;
+	}
+
+	if (!sip_cb) {
+		ast_log(LOG_ERROR, "Midcom: Module not initialized properly\n");
+		if (option_verbose > 1)
+		   ast_verbose("Midcom: Error!! - Module not initialized\n");
+		return 0;
+	}
+
+	if ((r = sip_cb->ast_get_hook_struct(p)))
+		return 1;
+
+	if (is_farend_nat())
+		{
+		  r = midcom_rule_alloc(p);
+		  if (r == NULL)
 	return 0;
-      
-      if (!r->username[0])
+		  
+		  if (!r->username[0])
 		  strncpy(r->username, sip_cb->ast_get_username(p), 256);
 
-      if (option_verbose > 1)
-        ast_verbose("Midcom: Allocating new rule for phone: %s\n", r->username);
-      /* sip_cb->ast_get_recv_addr(p, &r->midbox_addr); */
-      if ( get_lb_midbox_ip(&r->midbox_addr) == -1)
-        return 0;
+		  if (option_verbose > 1)
+		    ast_verbose("Midcom: Allocating new rule for phone: %s\n", r->username);
+		  /* sip_cb->ast_get_recv_addr(p, &r->midbox_addr); */
+		  if ( get_lb_midbox_ip(&r->midbox_addr) == -1)
+		    return 0;
 		
-      if ((r->midbox_addr.s_addr) && (r->con = midcom_connect(r->midbox_addr, &r->lifetime, &r->is_cached)) != -1) {
+		  if ((r->midbox_addr.s_addr) && (r->con = midcom_connect(r->midbox_addr, &r->lifetime, &r->is_cached)) != -1) {
 		  
 		  sip_cb->ast_rtp_get_us_audio_helper(p, &sin);
 		  if (!r->novideo)
@@ -843,7 +859,7 @@
 		  
 		  codec = sip_cb->ast_get_capability_helper(p);
 		  if (midcom_open_firewall(r->con, &r->ruleid, &r->our_internal_addr, &sin, &r->lifetime, (codec & 0x0000FFFF)) != 0) {
-                         if (option_verbose > 1)
+		                     if (option_verbose > 1)
 			   ast_verbose("Midcom: Failed to open dynamic pinhole for Audio stream from phone: %s\n", r->username); 
 			 free(r);
 			 r = NULL;
@@ -851,75 +867,75 @@
 		  }
 		  if (!r->novideo) {
 			 if (midcom_open_firewall(r->con, &r->vruleid, &r->our_internal_vaddr, &vsin, &r->lifetime, (codec & 0xFFFF0000)) != 0) {
-                                if (option_verbose > 1)
+		                            if (option_verbose > 1)
 			           ast_verbose("Midcom: Failed to open dynamic pinhole for Video stream from phone: %s\n", r->username); 
 				free(r);
 				r = NULL;
 				return 0;
 			 }
 		  }
-      } else {
+		  } else {
 		  ast_log(LOG_NOTICE, "Failed to connect to %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), r->midbox_addr));
 		  free(r);
 		  return 0;
-      }
-      
-      r->firewall_done = 1;
-      midcom_disconnect(r->con, r->is_cached);
-      timer_setup_tick(r, sizeof(struct midcom_rule), r->lifetime, &r->timer_handle);
-
-      ast_mutex_lock(&usecnt_lock);
-      usecnt++;
-      ast_mutex_unlock(&usecnt_lock);
-      ast_update_use_count();
-      
-      sip_cb->ast_map_hook_struct(p, (void *)r);
-      r->p = p;
-      r->next = midcom_rule_head;
-      midcom_rule_head = r;
-    }
-  return 1;
+		  }
+		  
+		  r->firewall_done = 1;
+		  midcom_disconnect(r->con, r->is_cached);
+		  timer_setup_tick(r, sizeof(struct midcom_rule), r->lifetime, &r->timer_handle);
+
+		  ast_mutex_lock(&usecnt_lock);
+		  usecnt++;
+		  ast_mutex_unlock(&usecnt_lock);
+		  ast_update_use_count();
+		  
+		  sip_cb->ast_map_hook_struct(p, (void *)r);
+		  r->p = p;
+		  r->next = midcom_rule_head;
+		  midcom_rule_head = r;
+		}
+	return 1;
 }
 
 static int midcom_transmit_reinvite_with_sdp_hook(void *p)
 {
-  char iabuf[INET_ADDRSTRLEN], iabuf1[INET_ADDRSTRLEN];
-  struct ast_channel *bridgepeer = NULL;
-  struct midcom_rule *r = NULL;
-  int res = -1;
-  int codec = 0;
-  struct midcom_rule *peer=NULL;
-  int is_farend = 0;
-  char *username = NULL;
-
-  if (!midcom_enabled) {
-    ast_log(LOG_ERROR, "Midcom: Module not enabled\n");
-    if (option_verbose > 1)
-      ast_verbose("Midcom: Module currently disabled\n");
-    return 1;
-  }
-
-  if (!sip_cb) {
-    ast_log(LOG_ERROR, "Midcom: Module not initialized properly\n");
-    if (option_verbose > 1)
-      ast_verbose("Midcom: Error!! - Module not initialized\n");
-    return 0;
-  }
-
-  if (!(r = sip_cb->ast_get_hook_struct(p))) {
-
-    username = sip_cb->ast_get_username(p);
-    ast_log(LOG_ERROR, "Midcom: Unable to retrieve Midcom Rule for phone: %s\n", username);
-    if (option_verbose > 1)
-      ast_verbose("Midcom: Error!! - Unable to retrieve Midcom Rule for phone: %s\n", username);
-    return 0;
-  }
-
-  is_farend = is_farend_nat();
-
-  if (is_farend)
-    {
-      if (!r->nat_done)
+	char iabuf[INET_ADDRSTRLEN], iabuf1[INET_ADDRSTRLEN];
+	struct ast_channel *bridgepeer = NULL;
+	struct midcom_rule *r = NULL;
+	int res = -1;
+	int codec = 0;
+	struct midcom_rule *peer=NULL;
+	int is_farend = 0;
+	char *username = NULL;
+
+	if (!midcom_enabled) {
+		ast_log(LOG_ERROR, "Midcom: Module not enabled\n");
+		if (option_verbose > 1)
+		  ast_verbose("Midcom: Module currently disabled\n");
+		return 1;
+	}
+
+	if (!sip_cb) {
+		ast_log(LOG_ERROR, "Midcom: Module not initialized properly\n");
+		if (option_verbose > 1)
+		  ast_verbose("Midcom: Error!! - Module not initialized\n");
+		return 0;
+	}
+
+	if (!(r = sip_cb->ast_get_hook_struct(p))) {
+
+		username = sip_cb->ast_get_username(p);
+		ast_log(LOG_ERROR, "Midcom: Unable to retrieve Midcom Rule for phone: %s\n", username);
+		if (option_verbose > 1)
+		  ast_verbose("Midcom: Error!! - Unable to retrieve Midcom Rule for phone: %s\n", username);
+		return 0;
+	}
+
+	is_farend = is_farend_nat();
+
+	if (is_farend)
+		{
+		  if (!r->nat_done)
 	{
 	  int first_phone = 0;
 
@@ -939,13 +955,13 @@
 	      return 0;
 	    }
 	    
-            peer = get_peer_rule(r);
-            if (peer == NULL)
+		        peer = get_peer_rule(r);
+		        if (peer == NULL)
 		return 0;
 
 	    if (midcom_reserve_nat(r->con, &r->ruleid, &r->our_natted_addr, /*r->enable_rtcp*/ 1, &r->lifetime) != 0) {
 	      ast_log(LOG_NOTICE, "Failed to NAT user %s for audio\n", r->username);
-              if (option_verbose > 1)
+		          if (option_verbose > 1)
 	         ast_verbose("Midcom: Failed to acquire NAT IP for user %s for audio\n", r->username);
 	      return 0;
 	    }
@@ -953,14 +969,14 @@
 	    if ((!r->novideo) && (!peer->novideo)) {
 	      if (midcom_reserve_nat(r->con, &r->vruleid, &r->our_natted_vaddr, /*r->enable_rtcp*/ 1, &r->lifetime) != 0) {
 		ast_log(LOG_NOTICE, "Failed to NAT user %s for video\n", r->username);
-                if (option_verbose > 1)
+		            if (option_verbose > 1)
 		  ast_verbose("Midcom: Failed to acquire NAT IP for user %s for video\n", r->username);
 		return 0;
 	      }
 	    }
-            else
-              /* if the peer does not support video, no need for video on our side too */
-              r->novideo = 1; 
+		        else
+		          /* if the peer does not support video, no need for video on our side too */
+		          r->novideo = 1; 
 	  } else {
 	    ast_log(LOG_NOTICE, "Failed to connect to %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), r->midbox_addr));
 	    return 0;
@@ -968,13 +984,13 @@
 
 	  r->nat_done = 1;
 
-          if (option_verbose > 1)
-            ast_verbose("Midcom: Acquired NAT IP: %s port: %d for phone %s audio stream with Originating IP: %s port: %d\n", ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_addr.sin_addr),  ntohs(r->our_natted_addr.sin_port), r->username, ast_inet_ntoa(iabuf, sizeof(iabuf), r->our_internal_addr.sin_addr), ntohs(r->our_internal_addr.sin_port));
+		      if (option_verbose > 1)
+		        ast_verbose("Midcom: Acquired NAT IP: %s port: %d for phone %s audio stream with Originating IP: %s port: %d\n", ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_addr.sin_addr),  ntohs(r->our_natted_addr.sin_port), r->username, ast_inet_ntoa(iabuf, sizeof(iabuf), r->our_internal_addr.sin_addr), ntohs(r->our_internal_addr.sin_port));
 
 	  if (!r->novideo) {
-             if (option_verbose > 1)
-               ast_verbose("Midcom: Acquired NAT IP: %s port: %d for phone %s video stream with Originating IP: %s port: %d\n", ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_vaddr.sin_addr),  ntohs(r->our_natted_vaddr.sin_port), r->username, ast_inet_ntoa(iabuf, sizeof(iabuf), r->our_internal_vaddr.sin_addr), ntohs(r->our_internal_vaddr.sin_port));
-          }
+		         if (option_verbose > 1)
+		           ast_verbose("Midcom: Acquired NAT IP: %s port: %d for phone %s video stream with Originating IP: %s port: %d\n", ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_vaddr.sin_addr),  ntohs(r->our_natted_vaddr.sin_port), r->username, ast_inet_ntoa(iabuf, sizeof(iabuf), r->our_internal_vaddr.sin_addr), ntohs(r->our_internal_vaddr.sin_port));
+		      }
 	  if (first_phone)
 	    {
 	      /*
@@ -988,19 +1004,19 @@
 	    }
 	} /* (!r->nat_done) */
 
-      r->redirip_nat = r->our_natted_addr;
-      r->vredirip_nat = r->our_natted_vaddr;
-
-    }
-
-  if (!r->username[0])
-    strncpy(r->username, sip_cb->ast_get_username(p), 256);
-
-  if (!r->firewall_done)
-    {
-      r->firewall_done = 1;
-
-      if ((r->midbox_addr.s_addr) && (r->con != -1))
+		  r->redirip_nat = r->our_natted_addr;
+		  r->vredirip_nat = r->our_natted_vaddr;
+
+		}
+
+	if (!r->username[0])
+		strncpy(r->username, sip_cb->ast_get_username(p), 256);
+
+	if (!r->firewall_done)
+		{
+		  r->firewall_done = 1;
+
+		  if ((r->midbox_addr.s_addr) && (r->con != -1))
 	{
 	  codec = sip_cb->ast_get_capability_helper(p);
 	  if (is_farend)
@@ -1011,17 +1027,17 @@
 	  if (res != 0)
 	    {
 	      /* free r */
-              if (peer && is_farend) {
-                 if (option_verbose > 1)
-                     ast_verbose("Midcom: Failed to Bridge Audio streams of phone %s with IP: %s port %d and Phone %s with IP; %s port %d\n", r->username, ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_addr.sin_addr),  ntohs(r->our_natted_addr.sin_port), peer->username, ast_inet_ntoa(iabuf, sizeof(iabuf), peer->our_natted_addr.sin_addr), ntohs(peer->our_natted_addr.sin_port));
-              }
+		          if (peer && is_farend) {
+		             if (option_verbose > 1)
+		                 ast_verbose("Midcom: Failed to Bridge Audio streams of phone %s with IP: %s port %d and Phone %s with IP; %s port %d\n", r->username, ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_addr.sin_addr),  ntohs(r->our_natted_addr.sin_port), peer->username, ast_inet_ntoa(iabuf, sizeof(iabuf), peer->our_natted_addr.sin_addr), ntohs(peer->our_natted_addr.sin_port));
+		          }
 	      return 0;
 	    }
 
-          if (peer && is_farend) {
-             if (option_verbose > 1)
-                 ast_verbose("Midcom: Bridging Audio streams of phone %s with IP: %s port %d and Phone %s with IP; %s port %d\n", r->username, ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_addr.sin_addr),  ntohs(r->our_natted_addr.sin_port), peer->username, ast_inet_ntoa(iabuf, sizeof(iabuf), peer->our_natted_addr.sin_addr), ntohs(peer->our_natted_addr.sin_port));
-          }
+		      if (peer && is_farend) {
+		         if (option_verbose > 1)
+		             ast_verbose("Midcom: Bridging Audio streams of phone %s with IP: %s port %d and Phone %s with IP; %s port %d\n", r->username, ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_addr.sin_addr),  ntohs(r->our_natted_addr.sin_port), peer->username, ast_inet_ntoa(iabuf, sizeof(iabuf), peer->our_natted_addr.sin_addr), ntohs(peer->our_natted_addr.sin_port));
+		      }
 
 	  if (!r->novideo) 
 	    {
@@ -1034,492 +1050,492 @@
 		{
 		  /* free r */
 	          if (peer && is_farend) {
-                     if (option_verbose > 1)
-                        ast_verbose("Midcom: Failed to Bridge Video streams of phone %s with IP: %s port %d and Phone %s with IP; %s port %d\n", r->username, ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_vaddr.sin_addr),  ntohs(r->our_natted_vaddr.sin_port), peer->username, ast_inet_ntoa(iabuf, sizeof(iabuf), peer->our_natted_vaddr.sin_addr), ntohs(peer->our_natted_vaddr.sin_port));
-                  }
+		                 if (option_verbose > 1)
+		                    ast_verbose("Midcom: Failed to Bridge Video streams of phone %s with IP: %s port %d and Phone %s with IP; %s port %d\n", r->username, ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_vaddr.sin_addr),  ntohs(r->our_natted_vaddr.sin_port), peer->username, ast_inet_ntoa(iabuf, sizeof(iabuf), peer->our_natted_vaddr.sin_addr), ntohs(peer->our_natted_vaddr.sin_port));
+		              }
 		  return 0;
 		}
 	    }
 	  if (!r->novideo && peer && is_farend) {
-             if (option_verbose > 1)
-                ast_verbose("Midcom: Bridging Video streams of phone %s with IP: %s port %d and Phone %s with IP; %s port %d\n", r->username, ast_inet_ntoa(iabuf1, sizeof(iabuf1), r->our_natted_vaddr.sin_addr),  ntohs(r->our_natted_vaddr.sin_port), peer->username, ast_inet_ntoa(iabuf, sizeof(iabuf), peer->our_natted_vaddr.sin_addr), ntohs(peer->our_natted_vaddr.sin_port));
-          }
+		         if (option_verbose > 1)

[... 1016 lines stripped ...]


More information about the svn-commits mailing list