--- asterisk/channels/chan_sip.c 2005-01-27 22:38:16.000000000 -0700 +++ asterisk-20050129/channels/chan_sip.c 2005-01-29 16:25:18.000000000 -0700 @@ -401,6 +401,7 @@ struct sip_history *history; /* History of this SIP dialog */ struct ast_variable *vars; struct sip_pvt *next; /* Next call in chain */ + int onhold; /* call on hold */ } *iflist = NULL; #define FLAG_RESPONSE (1 << 0) @@ -586,6 +587,7 @@ static void prune_peers(void); static int sip_do_reload(void); +static int holdevents = 0; /*--- sip_debug_test_addr: See if we pass debug IP filter */ static inline int sip_debug_test_addr(struct sockaddr_in *addr) @@ -2803,10 +2805,25 @@ /* Turn on/off music on hold if we are holding/unholding */ if (sin.sin_addr.s_addr && !sendonly) { ast_moh_stop(ast_bridged_channel(p->owner)); + if (holdevents && p->onhold) { + manager_event(EVENT_FLAG_CALL, "Unhold", + "Channel: %s\r\n" + "Uniqueid: %s\r\n", + p->owner->name, + p->owner->uniqueid); + } } else { ast_moh_start(ast_bridged_channel(p->owner), NULL); if (sendonly) ast_rtp_stop(p->rtp); + if (holdevents) { + manager_event(EVENT_FLAG_CALL, "Hold", + "Channel: %s\r\n" + "Uniqueid: %s\r\n", + p->owner->name, + p->owner->uniqueid); + p->onhold = 1; + } } } } @@ -9229,6 +9246,8 @@ } else { ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config); } + } else if (!strcasecmp(v->name, "holdevents")) { + holdevents = ast_true(v->value); } /* else if (strcasecmp(v->name,"type")) * ast_log(LOG_WARNING, "Ignoring %s\n", v->name); --- asterisk/configs/sip.conf.sample 2005-01-11 11:39:48.000000000 -0700 +++ asterisk-20050129/configs/sip.conf.sample 2005-01-29 16:21:39.000000000 -0700 @@ -118,6 +118,7 @@ ; (instead of type=friend) if you have calls in both directions ;registertimeout=20 ; retry registration calls every 20 seconds (default) +;holdevents=no ; generate manager events when sip ua places call on hold ;---------------------------------------------- NAT SUPPORT ------------------------ ; The externip, externhost and localnet settings are used if you use Asterisk behind