[asterisk-commits] branch file/coremedia - r7322 in
/team/file/coremedia: ./ apps/ channels/ cod...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Dec 3 19:16:19 CST 2005
Author: file
Date: Sat Dec 3 19:16:14 2005
New Revision: 7322
URL: http://svn.digium.com/view/asterisk?rev=7322&view=rev
Log:
Support PBX created calls, and port alaw codec to coremedia
Modified:
team/file/coremedia/apps/Makefile
team/file/coremedia/channel.c
team/file/coremedia/channels/chan_sip.c
team/file/coremedia/codecs/Makefile
team/file/coremedia/codecs/codec_alaw.c
team/file/coremedia/include/asterisk/channel.h
team/file/coremedia/include/asterisk/pbx.h
team/file/coremedia/manager.c
team/file/coremedia/pbx.c
team/file/coremedia/pbx/pbx_spool.c
team/file/coremedia/res/res_features.c
team/file/coremedia/rtp.c
team/file/coremedia/sample.call
team/file/coremedia/slinfactory.c
Modified: team/file/coremedia/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/apps/Makefile?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/apps/Makefile (original)
+++ team/file/coremedia/apps/Makefile Sat Dec 3 19:16:14 2005
@@ -52,7 +52,7 @@
CYGSOLIB=-L.. -L. -L../res -lasterisk.dll -lres_features.so -lres_adsi.so -lres_monitor.so
else
CFLAGS+=-fPIC
-APPS+=app_sms.so
+#APPS+=app_sms.so
endif
#
Modified: team/file/coremedia/channel.c
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/channel.c?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/channel.c (original)
+++ team/file/coremedia/channel.c Sat Dec 3 19:16:14 2005
@@ -2533,10 +2533,9 @@
{
struct chanlist *chan;
struct ast_channel *c;
- struct ast_coremedia_handle *temp_handle = NULL;
struct ast_coremedia_handle *chan_capabilities = NULL;
- struct ast_coremedia_handle *combined = NULL;
- int foo;
+ struct ast_coremedia_entry *actual_format = NULL;
+ int foo, success = 0;
if (!cause)
cause = &foo;
@@ -2552,13 +2551,31 @@
continue;
/* Grab capabilites of channel and do a handle combine */
+ chan_capabilities = chan->tech->capabilities;
+ if (chan_capabilities != NULL) {
+ while (chan_capabilities != NULL) {
+ if (chan_capabilities->entry == format) {
+ success = 1;
+ actual_format = format;
+ break;
+ }
+ chan_capabilities = chan_capabilities->next;
+ }
+ } else {
+ success = 1;
+ actual_format = format;
+ }
ast_mutex_unlock(&chlock);
+ /* No compatible format */
+ if (success == 0)
+ return NULL;
+
if (!chan->tech->requester)
return NULL;
- if (!(c = chan->tech->requester(type, format, data, cause)))
+ if (!(c = chan->tech->requester(type, actual_format, data, cause)))
return NULL;
if (c->_state == AST_STATE_DOWN) {
Modified: team/file/coremedia/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/channels/chan_sip.c?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/channels/chan_sip.c (original)
+++ team/file/coremedia/channels/chan_sip.c Sat Dec 3 19:16:14 2005
@@ -926,7 +926,7 @@
static const struct ast_channel_tech sip_tech = {
.type = channeltype,
.description = "Session Initiation Protocol (SIP)",
- .capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
+ .capabilities = NULL,
.properties = AST_CHAN_TP_WANTSJITTER,
.requester = sip_request_call,
.devicestate = sip_devicestate,
@@ -11525,9 +11525,9 @@
ast_copy_string(p->username, ext, sizeof(p->username));
p->fullcontact[0] = 0;
}
-#if 0
- printf("Setting up to call extension '%s' at '%s'\n", ext ? ext : "<none>", host);
-#endif
+
+ ast_log(LOG_NOTICE, "Setting up to call extension '%s' at '%s'\n", ext ? ext : "<none>", host);
+
// p->prefcodec = format;
ast_mutex_lock(&p->lock);
tmpc = sip_new(p, AST_STATE_DOWN, host); /* Place the call */
Modified: team/file/coremedia/codecs/Makefile
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/codecs/Makefile?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/codecs/Makefile (original)
+++ team/file/coremedia/codecs/Makefile Sat Dec 3 19:16:14 2005
@@ -68,7 +68,7 @@
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
endif
-CODECS+=codec_gsm.so codec_ulaw.so
+CODECS+=codec_gsm.so codec_ulaw.so codec_alaw.so
all: depend $(CODECS)
Modified: team/file/coremedia/codecs/codec_alaw.c
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/codecs/codec_alaw.c?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/codecs/codec_alaw.c (original)
+++ team/file/coremedia/codecs/codec_alaw.c Sat Dec 3 19:16:14 2005
@@ -39,8 +39,8 @@
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/options.h"
-#include "asterisk/translate.h"
#include "asterisk/channel.h"
+#include "asterisk/coremedia.h"
#include "asterisk/alaw.h"
#define BUFFER_SIZE 8096 /* size for the translation buffers */
@@ -51,11 +51,6 @@
static char *tdesc = "A-law Coder/Decoder";
static int useplc = 0;
-
-/* Sample frame data (Mu data is okay) */
-
-#include "slin_ulaw_ex.h"
-#include "ulaw_slin_ex.h"
/*!
* \brief Private workspace for translating signed linear signals to alaw.
@@ -267,44 +262,6 @@
} else return NULL;
}
-
-/*!
- * \brief alawToLin_Sample
- */
-
-static struct ast_frame * alawtolin_sample (void)
-{
- static struct ast_frame f;
- f.frametype = AST_FRAME_VOICE;
- f.subclass = AST_FORMAT_ALAW;
- f.datalen = sizeof (ulaw_slin_ex);
- f.samples = sizeof(ulaw_slin_ex);
- f.mallocd = 0;
- f.offset = 0;
- f.src = __PRETTY_FUNCTION__;
- f.data = ulaw_slin_ex;
- return &f;
-}
-
-/*!
- * \brief LinToalaw_Sample
- */
-
-static struct ast_frame * lintoalaw_sample (void)
-{
- static struct ast_frame f;
- f.frametype = AST_FRAME_VOICE;
- f.subclass = AST_FORMAT_SLINEAR;
- f.datalen = sizeof (slin_ulaw_ex);
- /* Assume 8000 Hz */
- f.samples = sizeof (slin_ulaw_ex) / 2;
- f.mallocd = 0;
- f.offset = 0;
- f.src = __PRETTY_FUNCTION__;
- f.data = slin_ulaw_ex;
- return &f;
-}
-
/*!
* \brief alaw_Destroy
* Destroys a private workspace.
@@ -323,37 +280,41 @@
ast_update_use_count ();
}
-/*!
- * \brief The complete translator for alawToLin.
- */
-
-static struct ast_translator alawtolin = {
- "alawtolin",
- AST_FORMAT_ALAW,
- AST_FORMAT_SLINEAR,
- alawtolin_new,
- alawtolin_framein,
- alawtolin_frameout,
- alaw_destroy,
- /* NULL */
- alawtolin_sample
-};
-
-/*!
- * \brief The complete translator for LinToalaw.
- */
-
-static struct ast_translator lintoalaw = {
- "lintoalaw",
- AST_FORMAT_SLINEAR,
- AST_FORMAT_ALAW,
- lintoalaw_new,
- lintoalaw_framein,
- lintoalaw_frameout,
- alaw_destroy,
- /* NULL */
- lintoalaw_sample
-};
+static struct ast_coremedia_translator alaw2lin =
+ {
+ CM_DECODE,
+ alawtolin_new,
+ alawtolin_framein,
+ alawtolin_frameout,
+ alaw_destroy
+ };
+
+static struct ast_coremedia_translator lin2alaw =
+ {
+ CM_ENCODE,
+ lintoalaw_new,
+ lintoalaw_framein,
+ lintoalaw_frameout,
+ alaw_destroy
+ };
+
+static struct ast_coremedia_entry alaw_entry =
+ { "alaw",
+ TYPE_AUDIO,
+ 0,
+ 8000,
+ AST_FORMAT_ALAW,
+ &lin2alaw,
+ &alaw2lin,
+ };
+
+static struct ast_coremedia_rtp alawrtp =
+ { "PCMA",
+ 8,
+ 0,
+ 8000,
+ "alaw",
+ };
static void parse_config(void)
{
@@ -383,26 +344,20 @@
int unload_module (void)
{
- int res;
+ int res = 0;
ast_mutex_lock (&localuser_lock);
- res = ast_unregister_translator (&lintoalaw);
- if (!res)
- res = ast_unregister_translator (&alawtolin);
- if (localusecnt)
- res = -1;
+ ast_coremedia_unregister(&alaw_entry);
+ ast_coremedia_rtp_unregister(&alawrtp);
ast_mutex_unlock (&localuser_lock);
return res;
}
int load_module (void)
{
- int res;
+ int res = 0;
parse_config();
- res = ast_register_translator (&alawtolin);
- if (!res)
- res = ast_register_translator (&lintoalaw);
- else
- ast_unregister_translator (&alawtolin);
+ ast_coremedia_register(&alaw_entry);
+ ast_coremedia_rtp_register(&alawrtp);
return res;
}
Modified: team/file/coremedia/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/include/asterisk/channel.h?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/include/asterisk/channel.h (original)
+++ team/file/coremedia/include/asterisk/channel.h Sat Dec 3 19:16:14 2005
@@ -177,7 +177,7 @@
const char * const description;
/*! Bitmap of formats this channel can handle */
- int capabilities;
+ struct ast_coremedia_handle *capabilities;
/*! Technology Properties */
int properties;
Modified: team/file/coremedia/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/include/asterisk/pbx.h?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/include/asterisk/pbx.h (original)
+++ team/file/coremedia/include/asterisk/pbx.h Sat Dec 3 19:16:14 2005
@@ -563,11 +563,11 @@
/* Synchronously or asynchronously make an outbound call and send it to a
particular extension */
-int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **locked_channel);
+int ast_pbx_outgoing_exten(const char *type, struct ast_coremedia_entry *format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **locked_channel);
/* Synchronously or asynchronously make an outbound call and send it to a
particular application with given extension */
-int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **locked_channel);
+int ast_pbx_outgoing_app(const char *type, struct ast_coremedia_entry *format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **locked_channel);
/* Functions for returning values from structures */
const char *ast_get_context_name(struct ast_context *con);
Modified: team/file/coremedia/manager.c
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/manager.c?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/manager.c (original)
+++ team/file/coremedia/manager.c Sat Dec 3 19:16:14 2005
@@ -936,12 +936,12 @@
struct ast_channel *chan = NULL;
if (!ast_strlen_zero(in->app)) {
- res = ast_pbx_outgoing_app(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->app, in->appdata, &reason, 1,
+ res = ast_pbx_outgoing_app(in->tech, NULL, in->data, in->timeout, in->app, in->appdata, &reason, 1,
!ast_strlen_zero(in->cid_num) ? in->cid_num : NULL,
!ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
in->vars, &chan);
} else {
- res = ast_pbx_outgoing_exten(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->context, in->exten, in->priority, &reason, 1,
+ res = ast_pbx_outgoing_exten(in->tech, NULL, in->data, in->timeout, in->context, in->exten, in->priority, &reason, 1,
!ast_strlen_zero(in->cid_num) ? in->cid_num : NULL,
!ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
in->vars, &chan);
@@ -1083,10 +1083,10 @@
}
}
} else if (!ast_strlen_zero(app)) {
- res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 1, l, n, vars, NULL);
+ res = ast_pbx_outgoing_app(tech, NULL, data, to, app, appdata, &reason, 1, l, n, vars, NULL);
} else {
if (exten && context && pi)
- res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 1, l, n, vars, NULL);
+ res = ast_pbx_outgoing_exten(tech, NULL, data, to, context, exten, pi, &reason, 1, l, n, vars, NULL);
else {
astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'");
return 0;
Modified: team/file/coremedia/pbx.c
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/pbx.c?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/pbx.c (original)
+++ team/file/coremedia/pbx.c Sat Dec 3 19:16:14 2005
@@ -4949,7 +4949,7 @@
return 0; /* success */
}
-int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **channel)
+int ast_pbx_outgoing_exten(const char *type, struct ast_coremedia_entry *format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **channel)
{
struct ast_channel *chan;
struct async_stat *as;
@@ -5113,7 +5113,7 @@
return NULL;
}
-int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **locked_channel)
+int ast_pbx_outgoing_app(const char *type, struct ast_coremedia_entry *format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **locked_channel)
{
struct ast_channel *chan;
struct async_stat *as;
Modified: team/file/coremedia/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/pbx/pbx_spool.c?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/pbx/pbx_spool.c (original)
+++ team/file/coremedia/pbx/pbx_spool.c Sat Dec 3 19:16:14 2005
@@ -259,11 +259,11 @@
if (!ast_strlen_zero(o->app)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Attempting call on %s/%s for application %s(%s) (Retry %d)\n", o->tech, o->dest, o->app, o->data, o->retries);
- res = ast_pbx_outgoing_app(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, NULL);
+ res = ast_pbx_outgoing_app(o->tech, NULL, o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, NULL);
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Attempting call on %s/%s for %s@%s:%d (Retry %d)\n", o->tech, o->dest, o->exten, o->context,o->priority, o->retries);
- res = ast_pbx_outgoing_exten(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, NULL);
+ res = ast_pbx_outgoing_exten(o->tech, NULL, o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, NULL);
}
if (res) {
ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
Modified: team/file/coremedia/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/res/res_features.c?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/res/res_features.c (original)
+++ team/file/coremedia/res/res_features.c Sat Dec 3 19:16:14 2005
@@ -207,7 +207,7 @@
}
}
-static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name);
+static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, const char *type, struct ast_coremedia_entry *format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name);
static void *ast_bridge_call_thread(void *data)
@@ -718,7 +718,7 @@
cid_name = transferer->cid.cid_name;
if (ast_exists_extension(transferer, transferer_real_context,xferto, 1, cid_num)) {
snprintf(dialstr, sizeof(dialstr), "%s@%s/n", xferto, transferer_real_context);
- newchan = ast_feature_request_and_dial(transferer, "Local", transferer->nativeformat->format, dialstr, 15000, &outstate, cid_num, cid_name);
+ newchan = ast_feature_request_and_dial(transferer, "Local", transferer->nativeformat, dialstr, 15000, &outstate, cid_num, cid_name);
ast_indicate(transferer, -1);
if (newchan) {
res = ast_channel_make_compatible(transferer, newchan);
@@ -1071,7 +1071,7 @@
}
-static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name)
+static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, const char *type, struct ast_coremedia_entry *format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name)
{
int state = 0;
int cause = 0;
Modified: team/file/coremedia/rtp.c
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/rtp.c?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/rtp.c (original)
+++ team/file/coremedia/rtp.c Sat Dec 3 19:16:14 2005
@@ -1318,9 +1318,7 @@
int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f)
{
- struct ast_frame *f = NULL;
int codec;
- int hdrlen = 12;
int subclass;
struct ast_coremedia_rtp *rtp_entry = NULL;
Modified: team/file/coremedia/sample.call
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/sample.call?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/sample.call (original)
+++ team/file/coremedia/sample.call Sat Dec 3 19:16:14 2005
@@ -12,7 +12,7 @@
# Obviously, you MUST specify at least a channel in the same format as you
# would for the "Dial" application. Only one channel name is permitted.
#
-Channel: Zap/1
+Channel: SIP/polycom1
#
# You may also specify a wait time (default is 45 seconds) for how long to
# wait for the channel to be answered, a retry time (default is 5 mins)
@@ -28,7 +28,7 @@
# combination, or a context/extension/priority in which to start the PBX.
#
Context: default
-Extension: s
+Extension: 333
Priority: 1
#
Modified: team/file/coremedia/slinfactory.c
URL: http://svn.digium.com/view/asterisk/team/file/coremedia/slinfactory.c?rev=7322&r1=7321&r2=7322&view=diff
==============================================================================
--- team/file/coremedia/slinfactory.c (original)
+++ team/file/coremedia/slinfactory.c Sat Dec 3 19:16:14 2005
@@ -31,6 +31,7 @@
#include "asterisk/slinfactory.h"
#include "asterisk/logger.h"
+#include "asterisk/channel.h"
#include "asterisk/coremedia.h"
More information about the asterisk-commits
mailing list