diff --git a/net/asterisk16/files/patch-chan_sip.c.rt200ne b/net/asterisk16/files/patch-chan_sip.c.rt200ne new file mode 100644 index 0000000..e4be43d --- /dev/null +++ b/net/asterisk16/files/patch-chan_sip.c.rt200ne @@ -0,0 +1,158 @@ +*** channels/chan_sip.c.orig 2008-12-03 23:13:27.000000000 +0900 +--- channels/chan_sip.c 2009-02-04 15:38:57.000000000 +0900 +*************** +*** 241,246 **** +--- 241,249 ---- + + #define INITIAL_CSEQ 101 /*!< our initial sip sequence number */ + ++ /* RT-200NE HACK */ ++ #define MAX_RT200NE 4 /* Number of RT-200NEs */ ++ + #define DEFAULT_MAX_SE 1800 /*!< Session-Timer Default Session-Expires period (RFC 4028) */ + #define DEFAULT_MIN_SE 90 /*!< Session-Timer Default Min-SE period (RFC 4028) */ + +*************** +*** 739,744 **** +--- 742,751 ---- + static struct ast_ha *global_contact_ha = NULL; + static int global_dynamic_exclude_static = 0; + ++ /* RT-200NE HACK */ ++ static char global_rt200ne[MAX_RT200NE][20]; ++ static int global_rt200ne_cnt = 0; ++ + /*! \name Object counters @{ + * \bug These counters are not handled in a thread-safe way ast_atomic_fetchadd_int() + * should be used to modify these values. */ +*************** +*** 1893,1898 **** +--- 1900,1906 ---- + static char *sip_show_registry(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); + static char *sip_unregister(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); + static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); ++ static char *sip_show_rt200ne(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); + static const char *subscription_type2str(enum subscriptiontype subtype) attribute_pure; + static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype); + static char *complete_sip_peer(const char *word, int state, int flags2); +*************** +*** 13325,13330 **** +--- 13333,13368 ---- + return CLI_SUCCESS; + } + ++ /*! \brief Show registered RT-200NEs */ ++ static char *sip_show_rt200ne(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) ++ { ++ int tmp_i; ++ ++ switch (cmd) { ++ case CLI_INIT: ++ e->command = "sip show rt200ne"; ++ e->usage = ++ "Usage: sip show rt200ne\n" ++ " List RT-200NE(s) settings.\n"; ++ return NULL; ++ case CLI_GENERATE: ++ return NULL; ++ } ++ ++ if (a->argc != 3) ++ return CLI_SHOWUSAGE; ++ if (global_rt200ne_cnt == 0){ ++ ast_cli(a->fd,"No RT-200NE(s)\n"); ++ } else { ++ ast_cli(a->fd,"RT-200NE at ..\n"); ++ for (tmp_i=0;tmp_ifd, "- %-16.16s\n", global_rt200ne[tmp_i]); ++ } ++ } ++ ++ return CLI_SUCCESS; ++ } ++ + /*! \brief Show subscription type in string format */ + static const char *subscription_type2str(enum subscriptiontype subtype) + { +*************** +*** 14336,14341 **** +--- 14374,14384 ---- + const char *md5secret; + struct sip_auth *auth = NULL; /* Realm authentication */ + ++ /* RT-200NE HACK */ ++ char tmp_addr[20]; ++ char tmp_uri[256]; ++ int tmp_i; ++ + if (!ast_strlen_zero(p->domain)) + ast_copy_string(uri, p->domain, sizeof(uri)); + else if (!ast_strlen_zero(p->uri)) +*************** +*** 14343,14348 **** +--- 14386,14413 ---- + else + snprintf(uri, sizeof(uri), "sip:%s@%s", p->username, ast_inet_ntoa(p->sa.sin_addr)); + ++ /* RT-200NE HACK */ ++ strcpy(tmp_addr, ast_inet_ntoa(p->sa.sin_addr)); ++ /* ast_verbose(VERBOSE_PREFIX_3 "inet is %s \n", tmp_addr); */ ++ for (tmp_i=0;tmp_iuri, sizeof(tmp_uri)); ++ switch (method) { ++ case SIP_REGISTER: ++ sprintf(uri, "sip:%s",tmp_addr); ++ break; ++ default: ++ *strchr(tmp_uri, '@') = '\0'; ++ snprintf(uri, sizeof(uri), "%s@%s",tmp_uri,tmp_addr); ++ break; ++ } ++ } ++ } ++ } ++ /* RT-200NE HACK END */ ++ + snprintf(cnonce, sizeof(cnonce), "%08lx", ast_random()); + + /* Check if we have separate auth credentials */ +*************** +*** 21050,21055 **** +--- 21115,21124 ---- + + global_matchexterniplocally = FALSE; + ++ /* RT-200NE HACK */ ++ memset(global_rt200ne, 0, sizeof(global_rt200ne)); ++ global_rt200ne_cnt = 0; ++ + /* Copy the default jb config over global_jbconf */ + memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); + +*************** +*** 21390,21395 **** +--- 21459,21469 ---- + default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE; + } else if (!strcasecmp(v->name, "matchexterniplocally")) { + global_matchexterniplocally = ast_true(v->value); ++ } else if (!strcasecmp(v->name, "rt200ne")) { /*RT-200NE HACK*/ ++ if (global_rt200ne_cnt < MAX_RT200NE) { ++ ast_copy_string(global_rt200ne[global_rt200ne_cnt], v->value, sizeof(global_rt200ne)); ++ global_rt200ne_cnt++; ++ } + } else if (!strcasecmp(v->name, "session-timers")) { + int i = (int) str2stmode(v->value); + if (i < 0) { +*************** +*** 22201,22206 **** +--- 22275,22281 ---- + AST_CLI_DEFINE(sip_show_registry, "List SIP registration status"), + AST_CLI_DEFINE(sip_unregister, "Unregister (force expiration) a SIP peer from the registry"), + AST_CLI_DEFINE(sip_show_settings, "Show SIP global settings"), ++ AST_CLI_DEFINE(sip_show_rt200ne, "Show RT-200NE settings"), + AST_CLI_DEFINE(sip_notify, "Send a notify packet to a SIP peer"), + AST_CLI_DEFINE(sip_show_channel, "Show detailed SIP channel info"), + AST_CLI_DEFINE(sip_show_history, "Show SIP dialog history"),