aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_misdn.c
diff options
context:
space:
mode:
authorcrichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-13 12:58:32 +0000
committercrichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-13 12:58:32 +0000
commit4e98f2617c89733fd0923405c525ef15f18408d6 (patch)
treecd0922dc1cabf9c3146cab227c1cb06ef92a519c /channels/chan_misdn.c
parentf5e97674852e06b02f82995555854492bc4fc733 (diff)
fixed the crypt_keys stuff
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@58850 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_misdn.c')
-rw-r--r--channels/chan_misdn.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 7910be6fc..c340f84b8 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -4531,16 +4531,22 @@ static int misdn_set_opt_exec(struct ast_channel *chan, void *data)
case 'c':
keyidx=atoi(++tok);
- if (keyidx > misdn_key_vector_size || keyidx < 0 ) {
- ast_log(LOG_WARNING, "You entered the keyidx: %d but we have only %d keys\n",keyidx, misdn_key_vector_size );
- continue;
+ char keys[4096];
+ char *key=NULL, *tmp;
+ int i;
+ misdn_cfg_get( 0, MISDN_GEN_CRYPT_KEYS, keys, sizeof(keys));
+
+ tmp=keys;
+
+ for (i=0; i<keyidx; i++) {
+ key=strsep(&tmp,",");
}
-
- {
- ast_copy_string(ch->bc->crypt_key, misdn_key_vector[keyidx], sizeof(ch->bc->crypt_key));
+
+ if (key) {
+ ast_copy_string(ch->bc->crypt_key, key, sizeof(ch->bc->crypt_key));
}
- chan_misdn_log(0, ch->bc->port, "SETOPT: crypt with key:%s\n",misdn_key_vector[keyidx]);
+ chan_misdn_log(0, ch->bc->port, "SETOPT: crypt with key:%s\n",ch->bc->crypt_key);
break;
case 'e':