summaryrefslogtreecommitdiff
path: root/addons/ooh323cDriver.c
diff options
context:
space:
mode:
Diffstat (limited to 'addons/ooh323cDriver.c')
-rw-r--r--addons/ooh323cDriver.c105
1 files changed, 53 insertions, 52 deletions
diff --git a/addons/ooh323cDriver.c b/addons/ooh323cDriver.c
index dd07bb4b0..604336c21 100644
--- a/addons/ooh323cDriver.c
+++ b/addons/ooh323cDriver.c
@@ -226,15 +226,16 @@ int ooh323c_stop_stack_thread(void)
}
int ooh323c_set_capability
- (struct ast_codec_pref *prefs, int capability, int dtmf, int dtmfcodec)
+ (struct ast_codec_pref *prefs, struct ast_format_cap *cap, int dtmf, int dtmfcodec)
{
- int ret = 0, x, format=0;
+ int ret = 0, x;
+ struct ast_format tmpfmt;
if(gH323Debug)
ast_verbose("\tAdding capabilities to H323 endpoint\n");
- for(x=0; 0 != (format=ast_codec_pref_index(prefs, x)); x++)
+ for(x=0; ast_codec_pref_index(prefs, x, &tmpfmt); x++)
{
- if(format & AST_FORMAT_ULAW)
+ if(tmpfmt.id == AST_FORMAT_ULAW)
{
if(gH323Debug)
ast_verbose("\tAdding g711 ulaw capability to H323 endpoint\n");
@@ -244,7 +245,7 @@ int ooh323c_set_capability
&ooh323c_stop_receive_channel,
&ooh323c_stop_transmit_channel);
}
- if(format & AST_FORMAT_ALAW)
+ if(tmpfmt.id == AST_FORMAT_ALAW)
{
if(gH323Debug)
ast_verbose("\tAdding g711 alaw capability to H323 endpoint\n");
@@ -255,7 +256,7 @@ int ooh323c_set_capability
&ooh323c_stop_transmit_channel);
}
- if(format & AST_FORMAT_G729A)
+ if(tmpfmt.id == AST_FORMAT_G729A)
{
if(gH323Debug)
ast_verbose("\tAdding g729A capability to H323 endpoint\n");
@@ -281,7 +282,7 @@ int ooh323c_set_capability
&ooh323c_stop_transmit_channel);
}
- if(format & AST_FORMAT_G723_1)
+ if(tmpfmt.id == AST_FORMAT_G723_1)
{
if(gH323Debug)
ast_verbose("\tAdding g7231 capability to H323 endpoint\n");
@@ -293,7 +294,7 @@ int ooh323c_set_capability
}
- if(format & AST_FORMAT_G726)
+ if(tmpfmt.id == AST_FORMAT_G726)
{
if(gH323Debug)
ast_verbose("\tAdding g726 capability to H323 endpoint\n");
@@ -305,7 +306,7 @@ int ooh323c_set_capability
}
- if(format & AST_FORMAT_G726_AAL2)
+ if(tmpfmt.id == AST_FORMAT_G726_AAL2)
{
if(gH323Debug)
ast_verbose("\tAdding g726aal2 capability to H323 endpoint\n");
@@ -317,7 +318,7 @@ int ooh323c_set_capability
}
- if(format & AST_FORMAT_H263)
+ if(tmpfmt.id == AST_FORMAT_H263)
{
if(gH323Debug)
ast_verbose("\tAdding h263 capability to H323 endpoint\n");
@@ -329,7 +330,7 @@ int ooh323c_set_capability
}
- if(format & AST_FORMAT_GSM)
+ if(tmpfmt.id == AST_FORMAT_GSM)
{
if(gH323Debug)
ast_verbose("\tAdding gsm capability to H323 endpoint\n");
@@ -342,7 +343,7 @@ int ooh323c_set_capability
}
#ifdef AST_FORMAT_AMRNB
- if(format & AST_FORMAT_AMRNB)
+ if(tmpfmt.id == AST_FORMAT_AMRNB)
{
if(gH323Debug)
ast_verbose("\tAdding amr nb capability to H323 endpoint\n");
@@ -356,7 +357,7 @@ int ooh323c_set_capability
#endif
#ifdef AST_FORMAT_SPEEX
- if(format & AST_FORMAT_SPEEX)
+ if(tmpfmt.id == AST_FORMAT_SPEEX)
{
if(gH323Debug)
ast_verbose("\tAdding speex capability to H323 endpoint\n");
@@ -384,11 +385,11 @@ int ooh323c_set_capability
}
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, struct ast_format_cap *cap, int dtmf, int dtmfcodec,
int t38support)
{
int ret = 0, x, txframes;
- int format=0;
+ struct ast_format tmpfmt;
if(gH323Debug)
ast_verbose("\tAdding capabilities to call(%s, %s)\n", call->callType,
call->callToken);
@@ -409,9 +410,9 @@ int ooh323c_set_capability_for_call
&ooh323c_stop_transmit_datachannel,
0);
- for(x=0; 0 !=(format=ast_codec_pref_index(prefs, x)); x++)
+ for(x=0; ast_codec_pref_index(prefs, x, &tmpfmt); x++)
{
- if(format & AST_FORMAT_ULAW)
+ if(tmpfmt.id == AST_FORMAT_ULAW)
{
if(gH323Debug)
ast_verbose("\tAdding g711 ulaw capability to call(%s, %s)\n",
@@ -424,7 +425,7 @@ int ooh323c_set_capability_for_call
&ooh323c_stop_receive_channel,
&ooh323c_stop_transmit_channel);
}
- if(format & AST_FORMAT_ALAW)
+ if(tmpfmt.id == AST_FORMAT_ALAW)
{
if(gH323Debug)
ast_verbose("\tAdding g711 alaw capability to call(%s, %s)\n",
@@ -438,7 +439,7 @@ int ooh323c_set_capability_for_call
&ooh323c_stop_transmit_channel);
}
- if(format & AST_FORMAT_G726)
+ if(tmpfmt.id == AST_FORMAT_G726)
{
if(gH323Debug)
ast_verbose("\tAdding g726 capability to call (%s, %s)\n",
@@ -452,7 +453,7 @@ int ooh323c_set_capability_for_call
}
- if(format & AST_FORMAT_G726_AAL2)
+ if(tmpfmt.id == AST_FORMAT_G726_AAL2)
{
if(gH323Debug)
ast_verbose("\tAdding g726aal2 capability to call (%s, %s)\n",
@@ -466,7 +467,7 @@ int ooh323c_set_capability_for_call
}
- if(format & AST_FORMAT_G729A)
+ if(tmpfmt.id == AST_FORMAT_G729A)
{
txframes = (prefs->framing[x])/10;
@@ -497,7 +498,7 @@ int ooh323c_set_capability_for_call
}
- if(format & AST_FORMAT_G723_1)
+ if(tmpfmt.id == AST_FORMAT_G723_1)
{
if(gH323Debug)
ast_verbose("\tAdding g7231 capability to call (%s, %s)\n",
@@ -510,7 +511,7 @@ int ooh323c_set_capability_for_call
}
- if(format & AST_FORMAT_H263)
+ if(tmpfmt.id == AST_FORMAT_H263)
{
if(gH323Debug)
ast_verbose("\tAdding h263 capability to call (%s, %s)\n",
@@ -523,7 +524,7 @@ int ooh323c_set_capability_for_call
}
- if(format & AST_FORMAT_GSM)
+ if(tmpfmt.id == AST_FORMAT_GSM)
{
if(gH323Debug)
ast_verbose("\tAdding gsm capability to call(%s, %s)\n",
@@ -536,7 +537,7 @@ int ooh323c_set_capability_for_call
}
#ifdef AST_FORMAT_AMRNB
- if(format & AST_FORMAT_AMRNB)
+ if(tmpfmt.id == AST_FORMAT_AMRNB)
{
if(gH323Debug)
ast_verbose("\tAdding AMR capability to call(%s, %s)\n",
@@ -549,7 +550,7 @@ int ooh323c_set_capability_for_call
}
#endif
#ifdef AST_FORMAT_SPEEX
- if(format & AST_FORMAT_SPEEX)
+ if(tmpfmt.id == AST_FORMAT_SPEEX)
{
if(gH323Debug)
ast_verbose("\tAdding Speex capability to call(%s, %s)\n",
@@ -594,9 +595,9 @@ int ooh323c_set_aliases(ooAliases * aliases)
int ooh323c_start_receive_channel(ooCallData *call, ooLogicalChannel *pChannel)
{
- format_t fmt=-1;
- fmt = convertH323CapToAsteriskCap(pChannel->chanCap->cap);
- if(fmt>0) {
+ struct ast_format tmpfmt;
+ convertH323CapToAsteriskCap(pChannel->chanCap->cap, &tmpfmt);
+ if(tmpfmt.id) {
/* ooh323_set_read_format(call, fmt); */
}else{
ast_log(LOG_ERROR, "Invalid capability type for receive channel %s\n",
@@ -608,19 +609,19 @@ int ooh323c_start_receive_channel(ooCallData *call, ooLogicalChannel *pChannel)
int ooh323c_start_transmit_channel(ooCallData *call, ooLogicalChannel *pChannel)
{
- format_t fmt;
- fmt = convertH323CapToAsteriskCap(pChannel->chanCap->cap);
- if(fmt>0) {
- switch (fmt) {
+ struct ast_format tmpfmt;
+ convertH323CapToAsteriskCap(pChannel->chanCap->cap, &tmpfmt);
+ if(tmpfmt.id) {
+ switch (tmpfmt.id) {
case AST_FORMAT_ALAW:
case AST_FORMAT_ULAW:
- ooh323_set_write_format(call, fmt, ((OOCapParams *)(pChannel->chanCap->params))->txframes);
+ ooh323_set_write_format(call, &tmpfmt, ((OOCapParams *)(pChannel->chanCap->params))->txframes);
break;
case AST_FORMAT_G729A:
- ooh323_set_write_format(call, fmt, ((OOCapParams *)(pChannel->chanCap->params))->txframes*10);
+ ooh323_set_write_format(call, &tmpfmt, ((OOCapParams *)(pChannel->chanCap->params))->txframes*10);
break;
default:
- ooh323_set_write_format(call, fmt, 0);
+ ooh323_set_write_format(call, &tmpfmt, 0);
}
}else{
ast_log(LOG_ERROR, "Invalid capability type for receive channel %s\n",
@@ -665,47 +666,47 @@ int ooh323c_stop_transmit_datachannel(ooCallData *call, ooLogicalChannel *pChann
return 1;
}
-format_t convertH323CapToAsteriskCap(int cap)
+struct ast_format *convertH323CapToAsteriskCap(int cap, struct ast_format *result)
{
-
+ ast_format_clear(result);
switch(cap)
{
case OO_G711ULAW64K:
- return AST_FORMAT_ULAW;
+ return ast_format_set(result, AST_FORMAT_ULAW, 0);
case OO_G711ALAW64K:
- return AST_FORMAT_ALAW;
+ return ast_format_set(result, AST_FORMAT_ALAW, 0);
case OO_GSMFULLRATE:
- return AST_FORMAT_GSM;
+ return ast_format_set(result, AST_FORMAT_GSM, 0);
#ifdef AST_FORMAT_AMRNB
case OO_AMRNB:
- return AST_FORMAT_AMRNB;
+ return ast_format_set(result, AST_FORMAT_AMRNB, 0);
#endif
#ifdef AST_FORMAT_SPEEX
case OO_SPEEX:
- return AST_FORMAT_SPEEX;
+ return ast_format_set(result, AST_FORMAT_SPEEX, 0);
#endif
case OO_G729:
- return AST_FORMAT_G729A;
+ return ast_format_set(result, AST_FORMAT_G729A, 0);
case OO_G729A:
- return AST_FORMAT_G729A;
+ return ast_format_set(result, AST_FORMAT_G729A, 0);
case OO_G729B:
- return AST_FORMAT_G729A;
+ return ast_format_set(result, AST_FORMAT_G729A, 0);
case OO_G7231:
- return AST_FORMAT_G723_1;
+ return ast_format_set(result, AST_FORMAT_G723_1, 0);
case OO_G726:
- return AST_FORMAT_G726;
+ return ast_format_set(result, AST_FORMAT_G726, 0);
case OO_G726AAL2:
- return AST_FORMAT_G726_AAL2;
+ return ast_format_set(result, AST_FORMAT_G726_AAL2, 0);
case OO_H263VIDEO:
- return AST_FORMAT_H263;
+ return ast_format_set(result, AST_FORMAT_H263, 0);
default:
ast_debug(1, "Cap %d is not supported by driver yet\n", cap);
- return -1;
+ return NULL;
}
- return -1;
+ return NULL;
}