เวลามีใครโทรเข้ามา หรือเวลามีการวางหู ผมต้องการส่งการแจ้งเตือนหรือข่าวสาร (Notify) ไปแจ้งให้ระบบอื่นๆ ทราบ
เช่น พอวางหูเสร็จ ก็ส่ง CDR ไปบอกระบบ Billing เป็นต้น จะทำ Notification ลักษณะนี้ต้องทำอย่างไร?
Call Notification
system()
ผมเห็นตัวอย่างจาก voip-info: Asterisk call notification ใช้ผ่านคำสั่ง System() ใน extensions.conf เราเรียกคำสั่งที่ใช้ใน dialplan ว่า Asterisk Dialplan Commands
(extensions.conf เอาไว้เก็บ dialplan) ลองดูตัวอย่าง
[from-internal]
...
exten => 200,1,NoOp(${CALLERID} ${DATETIME})
exten => 200,2,System(/bin/echo -e "'Incoming Call From: ${CALLERID} \\r Received: ${DATETIME}'"|/usr/bin/smbclient -M target_netbiosname)
exten => 200,3,Dial,sip/tom|30|t ; Ring, 30 secs max
exten => 200,4,Congestion
...
ตัวอย่างด้านบนจะแสดง message dialog box ไปยังเครื่องปลายทาง ผ่านโปรแกรม smbclient เห็น ideas แล้วใช่ไหม ด้วย system() เราจะทำอะไรได้หลายอย่างด้วยการติดต่อกับ shell, php, perl, python, erlang, lulu เพื่อให้ทำงานตามต้องการ
ลองดู solutions อื่นๆ บ้าง
HooDaHek - Caller ID and Notification System
the Caller ID (CLID) and Notification System for the Asterisk open-source PBX system for Linux. This tool is designed to make your life a bit easier by allowing you to not only control what Caller ID says on your phone displays but to notify you of who is calling you in many convenient ways, such as instant messaging, email, and SMS messages.
link: http://www.hoodahek.com/
ADM - Asterisk Desktop Manager
link: http://adm.hamnett.org/
FOP - Asterisk Flash Operator Panel
ลองดู demo สิครับ เจ๋งไหม? เป็น webbase ง่ายดี ผมว่านี่เจ๋งสุดแล้ว
Feature
- Hang-up a channel
- Transfer a call leg via drag&drop
- Originate calls via drag&drop
- Barge in on a call using drag&drop
- Set the caller id when transferring or originating a call
- Automatically pop up web page with customer details
- Click-to-Dial from a web page
- Mute/Unmute meetme participants
link: http://www.asternic.org/
Billing Notification
ยังไม่ได้ sulutions เมื่อเวลาวางหูเลย จะดักอย่างไรดี ดักได้ตรงไหนบ้าง?….. กลับมาที่ Asterisk Dialplan Commands จะมีกลุ่มคำสั่งเกี่ยวกับ Billing อยู่ มีดังนี้
- ForkCDR: Fork The CDR into 2 seperate entities
- NoCDR: Make sure asterisk doesn’t save CDR for a certain call
- ResetCDR: Reset CDR data
- SetAccount: Sets account code
- SetAMAflags: Set the channel AMA Flags for billing
- SetCDRUserField: Set CDR User field
- AppendCDRUserField: Append data to CDR User field
เอาล่ะ น่าจะได้แนวทางแล้ว
เรื่องที่น่าอ่านต่อคือ Asterisk billing, Automatic Message Accounting
มี voip billing software รวบรวมไว้ที่ Voip Billing (
เยอะขนาดนี้เชียวเร๊อะ) และ asteriskbilling.com มีโปรแกรมน่าสนใจหลายตัว ตัวที่นิยมใช้คือ a2billing, AstBill
เอาล่ะสรุปก่อนครับว่า มีสองวิธี
1. สั่งผ่านช่องทางของ asterisk command ที่มีให้
2. ผ่าน third party software ซึ่งจะเชื่อมต่อกับ asterisk ให้
ส่วนจะใช้วิธีไหน ต้องดูตามความเหมาะสมอีกที
ครับ ตอนนี้ได้วิธีหนึ่ง ผมใช้วิธีนี้ คือ ไปเล่นที่ macro ตัวอย่างเช่น
<blockquote>
[macro-hangupcall]
exten => s,1,ResetCDR(w)
exten => s,n,system(echo “${DATETIME} - ${CALLERID} - ${CHANNEL}” >> /var/log/asterisk/calls)
exten => s,n,NoCDR()
</blockquote>…
ส่วนตัวแปรที่เห็นนั้น Asterisk ได้ัจัดเตรียมไว้จำนวนหนึ่ง รายละเอียดดูได้ที่ voip-info.org: Asterisk variables<p> </p>