Version 0.1.6 from FTP
authorMark Spencer <markster@digium.com>
Wed, 27 Dec 2000 13:38:58 +0000 (13:38 +0000)
committerMark Spencer <markster@digium.com>
Wed, 27 Dec 2000 13:38:58 +0000 (13:38 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@224 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/Makefile
channels/chan_iax.c
channels/iax.h

index c7d29c6..a9d78aa 100755 (executable)
@@ -12,7 +12,8 @@
 #
 
 CHANNEL_LIBS=chan_vofr.so chan_modem.so \
-            chan_modem_aopen.so chan_iax.so chan_oss.so
+            chan_modem_aopen.so chan_iax.so chan_oss.so \
+             chan_modem_i4l.so
 
 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
 
index 010dbff..77f8557 100755 (executable)
@@ -127,6 +127,15 @@ struct iax_peer {
        struct sockaddr_in addr;
        int formats;
        struct in_addr mask;
+
+       /* Dynamic Registration fields */
+       int dynamic;
+       struct sockaddr_in defaddr;
+       char regsecret[80];
+       char methods[80];
+       struct timeval nexpire;
+       int expire;
+       struct iax_ha *ha;
        struct iax_peer *next;
 };
        
@@ -2038,16 +2047,23 @@ static struct iax_peer *build_peer(char *name, struct ast_variable *v)
                        if (!strcasecmp(v->name, "secret")) 
                                strncpy(peer->secret, v->value, sizeof(peer->secret));
                        else if (!strcasecmp(v->name, "host")) {
-                               hp = gethostbyname(v->value);
-                               if (hp) {
-                                       memcpy(&peer->addr.sin_addr, hp->h_addr, sizeof(peer->addr.sin_addr));
+                               if (!strcasecmp(v->value, "dynamic")) {
+                                       /* They'll register with us */
+                                       peer->dynamic = 1;
+                                       memset(&peer->addr.sin_addr, 0, 4);
                                } else {
-                                       ast_log(LOG_WARNING, "Unable to lookup '%s'\n", v->value);
-                                       free(peer);
-                                       return NULL;
+                                       peer->dynamic = 0;
+                                       hp = gethostbyname(v->value);
+                                       if (hp) {
+                                               memcpy(&peer->addr.sin_addr, hp->h_addr, sizeof(peer->addr.sin_addr));
+                                       } else {
+                                               ast_log(LOG_WARNING, "Unable to lookup '%s'\n", v->value);
+                                               free(peer);
+                                               return NULL;
+                                       }
+                                       if (!maskfound)
+                                               inet_aton("255.255.255.255", &peer->mask);
                                }
-                               if (!maskfound)
-                                       inet_aton("255.255.255.255", &peer->mask);
                        }
                        else if (!strcasecmp(v->name, "mask")) {
                                maskfound++;
index 295b545..5f8f9c2 100755 (executable)
 #define AST_IAX_COMMAND_INVAL  10
 #define AST_IAX_COMMAND_LAGRQ  11
 #define AST_IAX_COMMAND_LAGRP  12
+#define AST_IAX_COMMAND_REGRQ  13
+#define AST_IAX_COMMAND_REGRP  14
+
+#define AST_DEFAULT_REG_EXPIRE  60     /* By default require re-registration once per minute */
 
 #define AST_DEFAULT_IAX_PORTNO 5036