<p>Alexander Anikin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8812">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_ooh323: introduce localras config parameter<br><br>Introduce localras parameter that specify source IP<br>for connecting to Gatekeeper. Useful for multihome configurations.<br><br>ASTERISK-25129 #close<br>Reported by: Dmitry Melekhov<br>Tested by: Dmitry Melekhov<br><br>Change-Id: I0b604b01793f3e02a776502659e07cd3fc7e3097<br>---<br>M addons/chan_ooh323.c<br>M addons/ooh323c/src/ooGkClient.c<br>M addons/ooh323c/src/ooGkClient.h<br>3 files changed, 17 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/12/8812/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c<br>index ffdbf67..0609650 100644<br>--- a/addons/chan_ooh323.c<br>+++ b/addons/chan_ooh323.c<br>@@ -355,6 +355,7 @@<br> static int gFAXdetect = FAXDETECT_CNG;<br> static int gT38Support = T38_FAXGW;<br> static char gGatekeeper[100];<br>+static char gRASIP[2+8*4+7]; /* Max for IPv6 addr */<br> static enum RasGatekeeperMode gRasGkMode = RasNoGatekeeper;<br> <br> static int gIsGateway = 0;<br>@@ -2726,7 +2727,7 @@<br> if (gRasGkMode == RasUseSpecificGatekeeper ||<br> gRasGkMode == RasDiscoverGatekeeper) {<br> ooGkClientInit(gRasGkMode, (gRasGkMode == RasUseSpecificGatekeeper) ?<br>- gGatekeeper : 0, 0);<br>+ gGatekeeper : 0, gRASIP, 0);<br> ooGkClientStart(gH323ep.gkClient);<br> }<br> <br>@@ -2869,6 +2870,7 @@<br> gTRCLVL = OOTRCLVLERR;<br> gRasGkMode = RasNoGatekeeper;<br> gGatekeeper[0] = '\0';<br>+ gRASIP[0] = '\0';<br> gRTPTimeout = 60;<br> gNat = FALSE;<br> gRTDRInterval = 0;<br>@@ -3029,6 +3031,9 @@<br> gRasGkMode = RasUseSpecificGatekeeper;<br> ast_copy_string(gGatekeeper, v->value, sizeof(gGatekeeper));<br> }<br>+ } else if (!strcasecmp(v->name, "localras")) {<br>+ ast_copy_string(gRASIP, v->value, sizeof(gRASIP));<br>+ ast_verb(3, " == Setting RAS IP to %s\n", gRASIP);<br> } else if (!strcasecmp(v->name, "logfile")) {<br> ast_copy_string(gLogFile, v->value, sizeof(gLogFile));<br> } else if (!strcasecmp(v->name, "context")) {<br>@@ -3924,9 +3929,9 @@<br> <br> /* Gatekeeper */<br> if (gRasGkMode == RasUseSpecificGatekeeper)<br>- ooGkClientInit(gRasGkMode, gGatekeeper, 0);<br>+ ooGkClientInit(gRasGkMode, gGatekeeper, gRASIP, 0);<br> else if (gRasGkMode == RasDiscoverGatekeeper)<br>- ooGkClientInit(gRasGkMode, 0, 0);<br>+ ooGkClientInit(gRasGkMode, 0, gRASIP, 0);<br> <br> /* Register callbacks */<br> ooH323EpSetH323Callbacks(h323Callbacks);<br>@@ -4013,7 +4018,7 @@<br> ooGkClientDestroy();<br> ast_verb(0, "Restart stopped gatekeeper client\n");<br> ooGkClientInit(gRasGkMode, (gRasGkMode == RasUseSpecificGatekeeper) ?<br>- gGatekeeper : 0, 0);<br>+ gGatekeeper : 0, gRASIP, 0);<br> ooGkClientStart(gH323ep.gkClient);<br> }<br> <br>diff --git a/addons/ooh323c/src/ooGkClient.c b/addons/ooh323c/src/ooGkClient.c<br>index a307f4e..4f78838 100644<br>--- a/addons/ooh323c/src/ooGkClient.c<br>+++ b/addons/ooh323c/src/ooGkClient.c<br>@@ -49,7 +49,7 @@<br> };<br> <br> int ooGkClientInit(enum RasGatekeeperMode eGkMode,<br>- char *szGkAddr, int iGkPort )<br>+ char *szGkAddr, char *szRasAddr, int iGkPort )<br> {<br> ooGkClient *pGkClient=NULL;<br> OOInterface *cur=NULL;<br>@@ -69,7 +69,11 @@<br> pGkClient->rrqRetries = 0;<br> pGkClient->grqRetries = 0;<br> <br>- strcpy(pGkClient->localRASIP, gH323ep.signallingIP);<br>+ if (szRasAddr && *szRasAddr) {<br>+ strcpy(pGkClient->localRASIP, szRasAddr);<br>+ } else {<br>+ strcpy(pGkClient->localRASIP, gH323ep.signallingIP);<br>+ }<br> #ifndef _WIN32<br> if(!strcmp(pGkClient->localRASIP, "0.0.0.0") ||<br> !strcmp(pGkClient->localRASIP, "127.0.0.1"))<br>@@ -90,7 +94,6 @@<br> }<br> if(cur)<br> {<br>- OOTRACEINFO2("Using local RAS Ip address %s\n", cur->addr);<br> strcpy(pGkClient->localRASIP, cur->addr);<br> }<br> else{<br>@@ -98,6 +101,7 @@<br> return OO_FAILED;<br> }<br> }<br>+ OOTRACEINFO2("Using local RAS Ip address %s\n", pGkClient->localRASIP);<br> #endif<br> if(OO_OK != ooGkClientSetGkMode(pGkClient, eGkMode, szGkAddr, iGkPort))<br> {<br>diff --git a/addons/ooh323c/src/ooGkClient.h b/addons/ooh323c/src/ooGkClient.h<br>index 017380b..e529b4a 100644<br>--- a/addons/ooh323c/src/ooGkClient.h<br>+++ b/addons/ooh323c/src/ooGkClient.h<br>@@ -223,7 +223,7 @@<br> *<br> */<br> EXTERN int ooGkClientInit<br>- (enum RasGatekeeperMode eGkMode, char *szGkAddr, int iGkPort );<br>+ (enum RasGatekeeperMode eGkMode, char *szGkAddr, char *szRasAddr, int iGkPort );<br> <br> /**<br> * This function is used to print the gatekeeper client configuration<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8812">change 8812</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8812"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I0b604b01793f3e02a776502659e07cd3fc7e3097 </div>
<div style="display:none"> Gerrit-Change-Number: 8812 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexander Anikin <may213@yandex.ru> </div>