On Mon, May 28, 2012 at 2:51 AM, Sherif Omran <sherifomran2000@yahoo.com>wrote:
Hi guys,
Any body knows how to schedule calls depending on some internal variables. Such as at 8pm, users with voice mail not yet delivered receive a call.
Thanks S.
You can also use the sched_api API command: http://wiki.freeswitch.org/wiki/Mod_commands#sched_api You'll need to convert to epoch seconds or use an offset from the current time. For example: sched_api +3600 foo originate user/1000 &park Will call user 1000 in 3600 seconds (1 hour) and park the call. (Obviously you'll send the call somewhere other than 'park') If you want an absolute time then you'll need to convert to epoch seconds. Use 'strepoch' to convert a date/time string into epoch seconds. The 'strftime' displays the current date/time in the proper format: freeswitch@internal> strftime 2012-05-29 12:40:22 By itself, 'strepoch' displays the current date/time in epoch seconds: freeswitch@internal> strepoch 1338320491 To get a specific date/time just feed it as an argument. 6PM tonight is this: freeswitch@internal> strepoch 2012-05-29 18:00:00 1338339600 Feed that into your sched_api: freeswitch@internal> sched_api 1338339600 foo originate user/1001 &park +OK Added: 10 2012-05-29 12:44:01.405063 [DEBUG] switch_scheduler.c:214 Added task 10 sched_api_function (foo) to run at 1338339600 And verify that task 10 is there: freeswitch@internal> show tasks task_id,task_desc,task_group,task_sql_manager,hostname 1,zrtp_cache_save,core,0,fs.debian 2,heartbeat,core,0,fs.debian 3,check_ip,core,0,fs.debian 4,limit_hash_cleanup,mod_hash,0,fs.debian *10,sched_api_function,foo,0,fs.debian* 5 total. freeswitch@internal> And use 'sched_del' to remove it if you no longer need it: freeswitch@internal> sched_del 10 +OK Deleted: 1 2012-05-29 12:46:22.845040 [DEBUG] switch_scheduler.c:138 Deleting task 10 sched_api_function (foo) Bonus feature: use 'expand' API to roll it all into a single command: freeswitch@internal> expand sched_api ${strepoch 2012-05-29 18:00:00} foo originate user/1001 &park +OK Added: 11 2012-05-29 12:48:11.785045 [DEBUG] switch_scheduler.c:214 Added task 11 sched_api_function (foo) to run at 1338339600 Please tinker away and let us know what you decide to do. You'll need something to talk to the FreeSWITCH event socket to send all these commands. Any ESL (event socket library) compatible language is a good choice. We have people who use Perl, Python, PHP, and Ruby all successfully, so any of those is a good choice. -MC