anthony.minessale at g... Guest
|
Posted: Thu Jan 15, 2009 5:33 pm Post subject: [Freeswitch-users] zapata.conf immediate=yes in Asterisk - F |
|
|
open a jira and attach a svn diff and we'll have a look
thanks
On Thu, Jan 15, 2009 at 5:14 AM, Scott Ellis <scott.ellis@novatex.com.au (scott.ellis@novatex.com.au)> wrote:
Quote: | So I decided to hack the code to see if I could just get it to do what I
wanted - assuming some kind of error in the options setting.
First I changed the state change code to just skip straight to IDLE
if (!event->channel->ring_count && (event->channel->state == ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(event->channel, ZAP_CHANNEL_INTHREAD))) {
// if (zap_test_flag(analog_data, ZAP_ANALOG_CALLERID)) {
// zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_GET_CALLERID);
// } else {
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_IDLE);
// }
event->channel->ring_count = 1;
zap_mutex_unlock(event->channel->mutex);
locked = 0;
zap_thread_create_detached(zap_analog_channel_run, event->channel);
} else {
event->channel->ring_count++;
}
So we skip the GET_CALLERID state altogether.
This generated an illegal state change message cannot go from DOWN to IDLE
So then changed the code to
if (!event->channel->ring_count && (event->channel->state == ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(event->channel, ZAP_CHANNEL_INTHREAD))) {
// if (zap_test_flag(analog_data, ZAP_ANALOG_CALLERID)) {
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_GET_CALLERID);
// } else {
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_IDLE);
// }
event->channel->ring_count = 1;
zap_mutex_unlock(event->channel->mutex);
locked = 0;
zap_thread_create_detached(zap_analog_channel_run, event->channel);
} else {
event->channel->ring_count++;
}
Allowing the state change to GET_CALLERID, then immediately to IDLE.
This works perfectly - the call is answered straight away. At the moment
I don't know enough about linux debugging to step through the parameter
code to see why setting get caller ID to false in openzap.conf.xml does
not get passed through, but even if it does the current code will still
run into the illegal state change error.
2009-01-15 21:59:18 [DEBUG] ozmod_analog.c:744 process_event() EVENT
[RING_START][1:1] STATE [DOWN]
2009-01-15 21:59:18 [DEBUG] ozmod_analog.c:760 process_event() Changing
state on 1:1 from DOWN to GET_CALLERID
2009-01-15 21:59:18 [DEBUG] ozmod_analog.c:762 process_event() Changing
state on 1:1 from GET_CALLERID to IDLE
2009-01-15 21:59:18 [DEBUG] ozmod_analog.c:239 zap_analog_channel_run()
ANALOG CHANNEL thread starting.
2009-01-15 21:59:18 [DEBUG] ozmod_analog.c:410 zap_analog_channel_run()
Executing state handler on 1:1 for IDLE
2009-01-15 21:59:18 [DEBUG] mod_openzap.c:1165 on_fxo_signal() got FXO
sig 1:1 [START]
2009-01-15 21:59:18 [DEBUG] mod_openzap.c:340 tech_init() Set codec PCMU
20ms
2009-01-15 21:59:18 [DEBUG] mod_openzap.c:1137 zap_channel_from_event()
Connect inbound channel OpenZAP/1:1/1
2009-01-15 21:59:18 [NOTICE] switch_channel.c:565
switch_channel_set_name() New Channel OpenZAP/1:1/1
[8e2a55c8-e2f3-11dd-adfd-6d934f226ffd]
Will go and put this into JIRA in the next couple of days.
Scott
Scott Ellis wrote:
Quote: | After poking around in the code, it looks like if I set <param
name="enable-callerid" value="false"/> in openzap.conf.xml, it should
skip the GET_CALLERID state, and I should get the call answered straight
away.
mod_openzap.c
} else if (!strcasecmp(var, "enable-callerid")) {
enable_callerid = val;
if (zap_configure_span("analog", span, on_analog_signal,
"tonemap", tonegroup,
"digit_timeout", &to,
"max_dialstr", &max,
"hotline", hotline,
"enable_callerid", enable_callerid,
TAG_END) != ZAP_SUCCESS) {
zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span
%d\n", span_id);
continue;
}
ozmod_analog.c
else if (!strcasecmp(var, "enable_callerid")) {
if (!(val = va_arg(ap, char *))) {
break;
}
if (zap_true(val)) {
flags |= ZAP_ANALOG_CALLERID;
} else {
flags &= ~ZAP_ANALOG_CALLERID;
}
and
case ZAP_OOB_RING_START:
{
if (event->channel->type != ZAP_CHAN_TYPE_FXO) {
zap_log(ZAP_LOG_ERROR, "Cannot get a RING_START event on
a non-fxo channel, please check your config.\n");
zap_set_state_locked(event->channel,
ZAP_CHANNEL_STATE_DOWN);
goto end;
}
if (!event->channel->ring_count && (event->channel->state ==
ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(event->channel,
ZAP_CHANNEL_INTHREAD))) {
if (zap_test_flag(analog_data, ZAP_ANALOG_CALLERID)) {
zap_set_state_locked(event->channel,
ZAP_CHANNEL_STATE_GET_CALLERID);
} else {
zap_set_state_locked(event->channel,
ZAP_CHANNEL_STATE_IDLE);
}
event->channel->ring_count = 1;
zap_mutex_unlock(event->channel->mutex);
locked = 0;
zap_thread_create_detached(zap_analog_channel_run,
event->channel);
} else {
event->channel->ring_count++;
}
}
break;
2009-01-15 20:19:44 [DEBUG] ozmod_analog.c:744 process_event() EVENT
[RING_START][1:1] STATE [DOWN]
2009-01-15 20:19:44 [DEBUG] ozmod_analog.c:760 process_event() Changing
state on 1:1 from DOWN to GET_CALLERID
2009-01-15 20:19:44 [DEBUG] ozmod_analog.c:239 zap_analog_channel_run()
ANALOG CHANNEL thread starting.
2009-01-15 20:19:44 [DEBUG] ozmod_analog.c:410 zap_analog_channel_run()
Executing state handler on 1:1 for GET_CALLERID
2009-01-15 20:19:44 [DEBUG] ozmod_analog.c:744 process_event() EVENT
[RING_START][1:1] STATE [GET_CALLERID]
2009-01-15 20:19:44 [DEBUG] ozmod_analog.c:744 process_event() EVENT
[RING_START][1:1] STATE [GET_CALLERID]
2009-01-15 20:19:45 [DEBUG] ozmod_analog.c:744 process_event() EVENT
[RING_START][1:1] STATE [GET_CALLERID]
2009-01-15 20:19:47 [DEBUG] ozmod_analog.c:744 process_event() EVENT
[RING_START][1:1] STATE [GET_CALLERID]
2009-01-15 20:19:47 [DEBUG] ozmod_analog.c:744 process_event() EVENT
[RING_START][1:1] STATE [GET_CALLERID]
2009-01-15 20:19:47 [DEBUG] ozmod_analog.c:744 process_event() EVENT
[RING_START][1:1] STATE [GET_CALLERID]
2009-01-15 20:19:48 [DEBUG] ozmod_analog.c:744 process_event() EVENT
[RING_START][1:1] STATE [GET_CALLERID]
2009-01-15 20:19:49 [DEBUG] ozmod_analog.c:292 zap_analog_channel_run()
Changing state on 1:1 from GET_CALLERID to IDLE
2009-01-15 20:19:49 [DEBUG] ozmod_analog.c:410 zap_analog_channel_run()
Executing state handler on 1:1 for IDLE
2009-01-15 20:19:49 [DEBUG] mod_openzap.c:1165 on_fxo_signal() got FXO
sig 1:1 [START]
The code all looks right, but I am not getting what I think should
happen. Anyone with any ideas?
Scott
Scott Ellis wrote:
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
|
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
|
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|