mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 06:48:25 +00:00
added g729onlyA option for announce only AnnexA g.729 codec in
h.323 capabilities. Option can be global or per user/peer. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@308242 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -185,6 +185,7 @@ static struct ooh323_pvt {
|
|||||||
int amaflags;
|
int amaflags;
|
||||||
int progsent; /* progress is sent */
|
int progsent; /* progress is sent */
|
||||||
int alertsent; /* alerting is sent */
|
int alertsent; /* alerting is sent */
|
||||||
|
int g729onlyA; /* G.729 only A */
|
||||||
struct ast_dsp *vad;
|
struct ast_dsp *vad;
|
||||||
struct OOH323Regex *rtpmask; /* rtp ip regexp */
|
struct OOH323Regex *rtpmask; /* rtp ip regexp */
|
||||||
char rtpmaskstr[120];
|
char rtpmaskstr[120];
|
||||||
@@ -217,6 +218,7 @@ struct ooh323_user{
|
|||||||
char rtpmaskstr[120];
|
char rtpmaskstr[120];
|
||||||
int rtdrcount, rtdrinterval;
|
int rtdrcount, rtdrinterval;
|
||||||
int faststart, h245tunneling;
|
int faststart, h245tunneling;
|
||||||
|
int g729onlyA;
|
||||||
struct ooh323_user *next;
|
struct ooh323_user *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -245,6 +247,7 @@ struct ooh323_peer{
|
|||||||
char rtpmaskstr[120];
|
char rtpmaskstr[120];
|
||||||
int rtdrcount,rtdrinterval;
|
int rtdrcount,rtdrinterval;
|
||||||
int faststart, h245tunneling;
|
int faststart, h245tunneling;
|
||||||
|
int g729onlyA;
|
||||||
struct ooh323_peer *next;
|
struct ooh323_peer *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -302,6 +305,7 @@ static int gBeMaster = 0;
|
|||||||
static int gMediaWaitForConnect = 0;
|
static int gMediaWaitForConnect = 0;
|
||||||
static int gTOS = 0;
|
static int gTOS = 0;
|
||||||
static int gRTPTimeout = 60;
|
static int gRTPTimeout = 60;
|
||||||
|
static int g729onlyA = 0;
|
||||||
static char gAccountcode[80] = DEFAULT_H323ACCNT;
|
static char gAccountcode[80] = DEFAULT_H323ACCNT;
|
||||||
static int gAMAFLAGS;
|
static int gAMAFLAGS;
|
||||||
static char gContext[AST_MAX_EXTENSION] = DEFAULT_CONTEXT;
|
static char gContext[AST_MAX_EXTENSION] = DEFAULT_CONTEXT;
|
||||||
@@ -515,6 +519,7 @@ static struct ooh323_pvt *ooh323_alloc(int callref, char *callToken)
|
|||||||
pvt->rtptimeout = gRTPTimeout;
|
pvt->rtptimeout = gRTPTimeout;
|
||||||
pvt->rtdrinterval = gRTDRInterval;
|
pvt->rtdrinterval = gRTDRInterval;
|
||||||
pvt->rtdrcount = gRTDRCount;
|
pvt->rtdrcount = gRTDRCount;
|
||||||
|
pvt->g729onlyA = g729onlyA;
|
||||||
|
|
||||||
pvt->call_reference = callref;
|
pvt->call_reference = callref;
|
||||||
if (callToken)
|
if (callToken)
|
||||||
@@ -636,6 +641,7 @@ static struct ast_channel *ooh323_request(const char *type, format_t format,
|
|||||||
|
|
||||||
p->capability = peer->capability;
|
p->capability = peer->capability;
|
||||||
memcpy(&p->prefs, &peer->prefs, sizeof(struct ast_codec_pref));
|
memcpy(&p->prefs, &peer->prefs, sizeof(struct ast_codec_pref));
|
||||||
|
p->g729onlyA = peer->g729onlyA;
|
||||||
p->dtmfmode |= peer->dtmfmode;
|
p->dtmfmode |= peer->dtmfmode;
|
||||||
p->dtmfcodec = peer->dtmfcodec;
|
p->dtmfcodec = peer->dtmfcodec;
|
||||||
p->t38support = peer->t38support;
|
p->t38support = peer->t38support;
|
||||||
@@ -664,6 +670,7 @@ static struct ast_channel *ooh323_request(const char *type, format_t format,
|
|||||||
ast_mutex_unlock(&iflock);
|
ast_mutex_unlock(&iflock);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
p->g729onlyA = g729onlyA;
|
||||||
p->dtmfmode = gDTMFMode;
|
p->dtmfmode = gDTMFMode;
|
||||||
p->dtmfcodec = gDTMFCodec;
|
p->dtmfcodec = gDTMFCodec;
|
||||||
p->t38support = gT38Support;
|
p->t38support = gT38Support;
|
||||||
@@ -1765,6 +1772,7 @@ int ooh323_onReceivedSetup(ooCallData *call, Q931Message *pmsg)
|
|||||||
ast_copy_string(p->accountcode, user->accountcode, sizeof(p->accountcode));
|
ast_copy_string(p->accountcode, user->accountcode, sizeof(p->accountcode));
|
||||||
p->amaflags = user->amaflags;
|
p->amaflags = user->amaflags;
|
||||||
p->capability = user->capability;
|
p->capability = user->capability;
|
||||||
|
p->g729onlyA = user->g729onlyA;
|
||||||
memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref));
|
memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref));
|
||||||
p->dtmfmode |= user->dtmfmode;
|
p->dtmfmode |= user->dtmfmode;
|
||||||
p->dtmfcodec = user->dtmfcodec;
|
p->dtmfcodec = user->dtmfcodec;
|
||||||
@@ -1777,9 +1785,11 @@ int ooh323_onReceivedSetup(ooCallData *call, Q931Message *pmsg)
|
|||||||
OO_SETFLAG(call->flags, OO_M_FASTSTART);
|
OO_SETFLAG(call->flags, OO_M_FASTSTART);
|
||||||
else
|
else
|
||||||
OO_CLRFLAG(call->flags, OO_M_FASTSTART);
|
OO_CLRFLAG(call->flags, OO_M_FASTSTART);
|
||||||
if (p->h245tunneling)
|
/* if we disable h245tun for this user then we clear flag */
|
||||||
OO_SETFLAG(call->flags, OO_M_TUNNELING);
|
/* in any other case we don't must touch this */
|
||||||
else
|
/* ie if we receive setup without h245tun but enabled
|
||||||
|
we can't enable it per call */
|
||||||
|
if (!p->h245tunneling)
|
||||||
OO_CLRFLAG(call->flags, OO_M_TUNNELING);
|
OO_CLRFLAG(call->flags, OO_M_TUNNELING);
|
||||||
|
|
||||||
if (user->rtpmask && user->rtpmaskstr[0]) {
|
if (user->rtpmask && user->rtpmaskstr[0]) {
|
||||||
@@ -1809,7 +1819,7 @@ int ooh323_onReceivedSetup(ooCallData *call, Q931Message *pmsg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ooh323c_set_capability_for_call(call, &p->prefs, p->capability, p->dtmfmode, p->dtmfcodec,
|
ooh323c_set_capability_for_call(call, &p->prefs, p->capability, p->dtmfmode, p->dtmfcodec,
|
||||||
p->t38support);
|
p->t38support, p->g729onlyA);
|
||||||
configure_local_rtp(p, call);
|
configure_local_rtp(p, call);
|
||||||
|
|
||||||
/* Incoming call */
|
/* Incoming call */
|
||||||
@@ -1976,7 +1986,7 @@ int onNewCallCreated(ooCallData *call)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ooh323c_set_capability_for_call(call, &p->prefs, p->capability,
|
ooh323c_set_capability_for_call(call, &p->prefs, p->capability,
|
||||||
p->dtmfmode, p->dtmfcodec, p->t38support);
|
p->dtmfmode, p->dtmfcodec, p->t38support, p->g729onlyA);
|
||||||
|
|
||||||
configure_local_rtp(p, call);
|
configure_local_rtp(p, call);
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
@@ -2191,6 +2201,7 @@ static struct ooh323_user *build_user(const char *name, struct ast_variable *v)
|
|||||||
user->t38support = gT38Support;
|
user->t38support = gT38Support;
|
||||||
user->faststart = gFastStart;
|
user->faststart = gFastStart;
|
||||||
user->h245tunneling = gTunneling;
|
user->h245tunneling = gTunneling;
|
||||||
|
user->g729onlyA = g729onlyA;
|
||||||
/* set default context */
|
/* set default context */
|
||||||
ast_copy_string(user->context, gContext, sizeof(user->context));
|
ast_copy_string(user->context, gContext, sizeof(user->context));
|
||||||
ast_copy_string(user->accountcode, gAccountcode, sizeof(user->accountcode));
|
ast_copy_string(user->accountcode, gAccountcode, sizeof(user->accountcode));
|
||||||
@@ -2212,6 +2223,8 @@ static struct ooh323_user *build_user(const char *name, struct ast_variable *v)
|
|||||||
user->faststart = ast_true(v->value);
|
user->faststart = ast_true(v->value);
|
||||||
} else if (!strcasecmp(v->name, "h245tunneling")) {
|
} else if (!strcasecmp(v->name, "h245tunneling")) {
|
||||||
user->h245tunneling = ast_true(v->value);
|
user->h245tunneling = ast_true(v->value);
|
||||||
|
} else if (!strcasecmp(v->name, "g729onlyA")) {
|
||||||
|
user->g729onlyA = ast_true(v->value);
|
||||||
} else if (!strcasecmp(v->name, "rtptimeout")) {
|
} else if (!strcasecmp(v->name, "rtptimeout")) {
|
||||||
user->rtptimeout = atoi(v->value);
|
user->rtptimeout = atoi(v->value);
|
||||||
if (user->rtptimeout < 0)
|
if (user->rtptimeout < 0)
|
||||||
@@ -2302,6 +2315,7 @@ static struct ooh323_peer *build_peer(const char *name, struct ast_variable *v,
|
|||||||
peer->t38support = gT38Support;
|
peer->t38support = gT38Support;
|
||||||
peer->faststart = gFastStart;
|
peer->faststart = gFastStart;
|
||||||
peer->h245tunneling = gTunneling;
|
peer->h245tunneling = gTunneling;
|
||||||
|
peer->g729onlyA = g729onlyA;
|
||||||
peer->port = 1720;
|
peer->port = 1720;
|
||||||
if (0 == friend_type) {
|
if (0 == friend_type) {
|
||||||
peer->mFriend = 1;
|
peer->mFriend = 1;
|
||||||
@@ -2352,6 +2366,8 @@ static struct ooh323_peer *build_peer(const char *name, struct ast_variable *v,
|
|||||||
peer->faststart = ast_true(v->value);
|
peer->faststart = ast_true(v->value);
|
||||||
} else if (!strcasecmp(v->name, "h245tunneling")) {
|
} else if (!strcasecmp(v->name, "h245tunneling")) {
|
||||||
peer->h245tunneling = ast_true(v->value);
|
peer->h245tunneling = ast_true(v->value);
|
||||||
|
} else if (!strcasecmp(v->name, "g729onlyA")) {
|
||||||
|
peer->g729onlyA = ast_true(v->value);
|
||||||
} else if (!strcasecmp(v->name, "rtptimeout")) {
|
} else if (!strcasecmp(v->name, "rtptimeout")) {
|
||||||
peer->rtptimeout = atoi(v->value);
|
peer->rtptimeout = atoi(v->value);
|
||||||
if(peer->rtptimeout < 0)
|
if(peer->rtptimeout < 0)
|
||||||
@@ -2581,6 +2597,8 @@ int reload_config(int reload)
|
|||||||
ooH323EpEnableH245Tunneling();
|
ooH323EpEnableH245Tunneling();
|
||||||
else
|
else
|
||||||
ooH323EpDisableH245Tunneling();
|
ooH323EpDisableH245Tunneling();
|
||||||
|
} else if (!strcasecmp(v->name, "g729onlyA")) {
|
||||||
|
g729onlyA = ast_true(v->value);
|
||||||
} else if (!strcasecmp(v->name, "roundtrip")) {
|
} else if (!strcasecmp(v->name, "roundtrip")) {
|
||||||
sscanf(v->value, "%d,%d", &gRTDRCount, &gRTDRInterval);
|
sscanf(v->value, "%d,%d", &gRTDRCount, &gRTDRInterval);
|
||||||
} else if (!strcasecmp(v->name, "trybemaster")) {
|
} else if (!strcasecmp(v->name, "trybemaster")) {
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ int ooh323c_set_capability
|
|||||||
|
|
||||||
int ooh323c_set_capability_for_call
|
int ooh323c_set_capability_for_call
|
||||||
(ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf, int dtmfcodec,
|
(ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf, int dtmfcodec,
|
||||||
int t38support)
|
int t38support, int g729onlyA)
|
||||||
{
|
{
|
||||||
int ret = 0, x, txframes;
|
int ret = 0, x, txframes;
|
||||||
int format=0;
|
int format=0;
|
||||||
@@ -471,17 +471,19 @@ int ooh323c_set_capability_for_call
|
|||||||
|
|
||||||
txframes = (prefs->framing[x])/10;
|
txframes = (prefs->framing[x])/10;
|
||||||
if(gH323Debug)
|
if(gH323Debug)
|
||||||
ast_verbose("\tAdding g729 capability to call(%s, %s)\n",
|
ast_verbose("\tAdding g729A capability to call(%s, %s)\n",
|
||||||
call->callType, call->callToken);
|
call->callType, call->callToken);
|
||||||
ret|= ooCallAddG729Capability(call, OO_G729, txframes, txframes,
|
ret= ooCallAddG729Capability(call, OO_G729A, txframes, txframes,
|
||||||
OORXANDTX, &ooh323c_start_receive_channel,
|
OORXANDTX, &ooh323c_start_receive_channel,
|
||||||
&ooh323c_start_transmit_channel,
|
&ooh323c_start_transmit_channel,
|
||||||
&ooh323c_stop_receive_channel,
|
&ooh323c_stop_receive_channel,
|
||||||
&ooh323c_stop_transmit_channel);
|
&ooh323c_stop_transmit_channel);
|
||||||
|
if (g729onlyA)
|
||||||
|
continue;
|
||||||
if(gH323Debug)
|
if(gH323Debug)
|
||||||
ast_verbose("\tAdding g729A capability to call(%s, %s)\n",
|
ast_verbose("\tAdding g729 capability to call(%s, %s)\n",
|
||||||
call->callType, call->callToken);
|
call->callType, call->callToken);
|
||||||
ret= ooCallAddG729Capability(call, OO_G729A, txframes, txframes,
|
ret|= ooCallAddG729Capability(call, OO_G729, txframes, txframes,
|
||||||
OORXANDTX, &ooh323c_start_receive_channel,
|
OORXANDTX, &ooh323c_start_receive_channel,
|
||||||
&ooh323c_start_transmit_channel,
|
&ooh323c_start_transmit_channel,
|
||||||
&ooh323c_stop_receive_channel,
|
&ooh323c_stop_receive_channel,
|
||||||
|
|||||||
@@ -41,5 +41,5 @@ int ooh323c_set_capability
|
|||||||
format_t convertH323CapToAsteriskCap(int cap);
|
format_t convertH323CapToAsteriskCap(int cap);
|
||||||
int ooh323c_set_capability_for_call
|
int ooh323c_set_capability_for_call
|
||||||
(ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf, int dtmfcodec,
|
(ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf, int dtmfcodec,
|
||||||
int t38support);
|
int t38support, int g729onlyA);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user