From 6049bb6539153c2f400f1f2dbc763c74d796204b Mon Sep 17 00:00:00 2001 From: kpfleming Date: Wed, 19 Jul 2006 20:44:39 +0000 Subject: merge Russell's 'hold_handling' branch, finally implementing music-on-hold handling the way it was decided at AstriDevCon Europe 2006 (and the way people really want it to be) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@37988 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_oss.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'channels/chan_oss.c') diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 36db65fc3..548e8d6dd 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -74,6 +74,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/endian.h" #include "asterisk/stringfields.h" #include "asterisk/abstract_jb.h" +#include "asterisk/musiconhold.h" /* ringtones we use */ #include "busy.h" @@ -136,6 +137,13 @@ START_CONFIG ; context = default ; default context for outgoing calls ; language = "" ; default language + ; Default Music on Hold class to use when this channel is placed on hold in + ; the case that the music class is not set on the channel with + ; Set(CHANNEL(musicclass)=whatever) in the dialplan and the peer channel + ; putting this one on hold did not suggest a class to use. + ; + ; mohinterpret=default + ; If you set overridecontext to 'yes', then the whole dial string ; will be interpreted as an extension, which is extremely useful ; to dial SIP, IAX and other extensions which use the '@' character. @@ -365,6 +373,7 @@ struct chan_oss_pvt { char language[MAX_LANGUAGE]; char cid_name[256]; /*XXX */ char cid_num[256]; /*XXX */ + char mohinterpret[MAX_MUSICCLASS]; /* buffers used in oss_write */ char oss_write_buf[FRAME_SIZE*2]; @@ -953,14 +962,24 @@ static int oss_indicate(struct ast_channel *c, int cond, const void *data, size_ case AST_CONTROL_VIDUPDATE: res = -1; break; + case AST_CONTROL_HOLD: + ast_verbose( " << Console Has Been Placed on Hold >> \n"); + ast_moh_start(c, data, o->mohinterpret); + break; + case AST_CONTROL_UNHOLD: + ast_verbose( " << Console Has Been Retrieved from Hold >> \n"); + ast_moh_stop(c); + break; default: ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, c->name); return -1; } + if (res > -1) ring(o, res); + return 0; } @@ -1434,6 +1453,8 @@ static struct chan_oss_pvt * store_config(struct ast_config *cfg, char *ctg) o->name = ast_strdup(ctg); } + strcpy(o->mohinterpret, "default"); + o->lastopen = ast_tvnow(); /* don't leave it 0 or tvdiff may wrap */ /* fill other fields from configuration */ for (v = ast_variable_browse(cfg, ctg);v; v=v->next) { @@ -1452,6 +1473,7 @@ static struct chan_oss_pvt * store_config(struct ast_config *cfg, char *ctg) M_UINT("queuesize", o->queuesize) M_STR("context", o->ctx) M_STR("language", o->language) + M_STR("mohinterpret", o->mohinterpret) M_STR("extension", o->ext) M_F("mixer", store_mixer(o, v->value)) M_F("callerid", store_callerid(o, v->value)) -- cgit v1.2.3