Page 1 of 1

Dynamic events

Posted: Thu Jan 28, 2010 3:24 pm
by Freeeze
Hello,

I have a problem with Caller ID detection from a modem.
I am using the Serial plugin which works great. When the phone rings I see the modem events. This is a great thing if I want to react on the
Serial.\nRING event (when the phone is ringing), however the Caller ID is transferred as Serial.\nNMBR = 555123456

As you can see the Caller ID is transferred as a part of the event name.

The macro would work fine if I had a gneric event:

Code: Select all

#get current event
event = eg.EventString
#check if it is the Caller ID Event
sfind = 'NMBR' in event
if sfind is True : print sfind
else : eg.StopMacro
#get the caller ID starting at the 16th digit
event = event[16:len(event)]
#store the number in global variable
eg.globals.myCallerID = event
How can I trigger my macro to react on the Caller ID Event? The following Event Items have not worked:

Serial.
Serial.*
Serial.\nNMBR{*}
Serial.{*}
Serial{*}


the Wildcards don't seem to have an effect...
Any ideas what can help?

Re: Dynamic events

Posted: Thu Jan 28, 2010 3:30 pm
by Bartman
Serial.* should work.
To really work with the EG naming scheme you can make your own plugin with events like Modem.NMBR.555123456

Re: Dynamic events

Posted: Thu Jan 28, 2010 3:40 pm
by Freeeze
Bartman wrote:Serial.* should work.
To really work with the EG naming scheme you can make your own plugin with events like Modem.NMBR.555123456
Hello Bartman,

Thank you - it worked!!! I have no idea why I have tested it as a false solution. Thanks as well for the plugin idea. :D

Re: Dynamic events

Posted: Thu Feb 11, 2010 12:20 pm
by Freeeze
This is the code which worked for me:

on startup you need to initialize the modem. To do this use the serial port plug in. This AT command may not be correct for your modem, however it worked fine on my 8Ôé¼ USB Modem from Singapore:

Code: Select all

AT+VCID=1\r
This is the actual python script which stores the caller ID in eg.globals:

Code: Select all

eg.globals.myCallerID=""
#get current event
event = eg.EventString
#check if it is the Caller ID Event
sfind = 'NMBR' in event
print sfind
if sfind is True : eg.globals.myCallerID = event[16:len(event)]
if sfind is False : eg.StopMacro()
if eg.globals.myCallerID == "P" : eg.globals.myCallerID = "Private"

Re: Dynamic events - Initialize Modem

Posted: Sat Aug 28, 2010 6:28 am
by kalia
Does anyone know if the modem needs to be reinitialized periodically using the "AT+VCID=1\r" command? My caller ID events don't always show up. Event is generated maybe every second phone call. Anyone else using the Serial plugin to get caller ID information from a modem?