Hi, there
Generally most users of gsm cards use them only for outgoing
connections, we want to use them also for incoming connections, but some
problems occured.
When connection comes to the asterisk trough chan_vgsm we can identify
the incoming port but there is not exten avaliable. We've needed such
functionality in our software to properly identify the end-user which
should be able to answer the call.
The idea we came was to add exten variable to the vgsm config for every
gsm port.
Since every sim card has it's own number, when changing sim cards you
would have to change vgsm config also, to avoid that you could set some
weird number like 000000001,000000002 (for every port) and get them
assigned to the end-users.
I don't know how do you like that idea, but it works for us like a charm.
(Patch assigned)
--
Mc.
diff -urNP chan_vgsm/chan_vgsm.c chan_vgsm-exten/chan_vgsm.c
--- chan_vgsm/chan_vgsm.c 2007-07-02 17:27:32.000000000 +0200
+++ chan_vgsm-exten/chan_vgsm.c 2007-07-31 16:16:45.000000000 +0200
@@ -1456,7 +1456,9 @@
struct ast_channel *ast_chan = vgsm_chan->ast_chan;
- strcpy(ast_chan->exten, "s");
+ strncpy(ast_chan->context, vgsm_chan->mc->context,
+ sizeof(ast_chan->context));
+
strncpy(ast_chan->context, vgsm_chan->mc->context,
sizeof(ast_chan->context));
ast_chan->priority = 1;
diff -urNP chan_vgsm/module.c chan_vgsm-exten/module.c
--- chan_vgsm/module.c 2007-07-02 17:27:32.000000000 +0200
+++ chan_vgsm-exten/module.c 2007-07-31 16:26:39.000000000 +0200
@@ -79,7 +79,8 @@
{
strcpy(mc->context, "vgsm");
strcpy(mc->pin, "");
-
+ strcpy(mc->exten, "s");
+
mc->rx_gain = 255;
mc->tx_gain = 255;
mc->set_clock = 0;
@@ -666,6 +667,8 @@
if (!strcasecmp(var->name, "device")) {
strncpy(mc->device_filename, var->value,
sizeof(mc->device_filename));
+ } else if (!strcasecmp(var->name, "exten")) {
+ strncpy(mc->exten, var->value, sizeof(mc->exten));
} else if (!strcasecmp(var->name, "context")) {
strncpy(mc->context, var->value, sizeof(mc->context));
} else if (!strcasecmp(var->name, "pin")) {
@@ -1182,6 +1185,7 @@
"---- Module '%s' ----\n"
" Device : %s\n"
" Context: %s\n"
+ " Exten : %s\n"
" RX-gain: %d\n"
" TX-gain: %d\n"
" Set clock: %s\n"
@@ -1191,6 +1195,7 @@
module->name,
mc->device_filename,
mc->context,
+ mc->exten,
mc->rx_gain,
mc->tx_gain,
mc->set_clock ? "YES" : "NO",
diff -urNP chan_vgsm/module.h chan_vgsm-exten/module.h
--- chan_vgsm/module.h 2007-07-02 17:27:32.000000000 +0200
+++ chan_vgsm-exten/module.h 2007-07-31 16:16:01.000000000 +0200
@@ -178,6 +178,7 @@
char device_filename[PATH_MAX];
char context[AST_MAX_EXTENSION];
+ char exten[AST_MAX_EXTENSION];
char pin[16];
__u8 rx_gain;
_______________________________________________
Visdn-hackers mailing list
[email protected]
https://mailman.uli.it/mailman/listinfo/visdn-hackers