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