diff --git a/CHANGES b/CHANGES index 171ac9e..73b3a04 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ HEAD - fixed big-endian issue for DATA_B3 messages in internal libcapi code. - fixed NULL-pointer when no digits are signaled in DID mode. - adapt to new Asterisk 1.6.1 changes. +- added capicommand to set CAPI application id into an Asterisk dialplan variable. chan_capi-1.1.1 diff --git a/README b/README index 17ee269..a47cfea 100644 --- a/README +++ b/README @@ -302,6 +302,11 @@ Progress / early-B3 on incoming calls: Example: exten => s,1,capicommand(progress) +Get CAPI application ID: + To store the CAPI application ID in an asterisk dialplan variable, use: + Example: + exten => s,1,capicommand(getid,CAPI_ID) + exten => s,2,NoOp(CAPI appl-id is ${CAPI_ID}) Using CLIR ========== diff --git a/chan_capi.c b/chan_capi.c index 7ad9c03..fc0617d 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -4241,6 +4241,24 @@ static int pbx_capi_call_deflect(struct ast_channel *c, char *param) return 0; } +/* + * store the peer for future actions + */ +static int pbx_capi_get_id(struct ast_channel *c, char *param) +{ + char buffer[32]; + + if ((!param) || (!(*param))) { + cc_log(LOG_WARNING, "Parameter for getid missing.\n"); + return -1; + } + + snprintf(buffer, sizeof(buffer) - 1, "%d", capi_ApplID); + pbx_builtin_setvar_helper(c, param, buffer); + + return 0; +} + /* * store the peer for future actions */ @@ -4760,6 +4778,7 @@ static struct capicommands_s { int (*cmd)(struct ast_channel *, char *); int capionly; } capicommands[] = { + { "getid", pbx_capi_get_id, 0 }, { "peerlink", pbx_capi_peer_link, 0 }, { "progress", pbx_capi_signal_progress, 1 }, { "deflect", pbx_capi_call_deflect, 1 }, @@ -5150,7 +5169,7 @@ static void *capidev_loop(void *data) time_t lastcall = 0; time_t newtime; - cc_log(LOG_NOTICE, "Started CAPI device thread.\n"); + cc_log(LOG_NOTICE, "Started CAPI device thread for CAPI Appl-ID %d.\n", capi_ApplID); for (/* for ever */;;) { switch(Info = capidev_check_wait_get_cmsg(&monCMSG)) {