After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 255854 - Feature Request: Integrate Evolution with Asterisk to autodial
Feature Request: Integrate Evolution with Asterisk to autodial
Status: RESOLVED WONTFIX
Product: evolution
Classification: Applications
Component: general
3.2.x (obsolete)
Other All
: Low enhancement
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on: 201428
Blocks:
 
 
Reported: 2004-03-20 10:07 UTC by Steve Murphy
Modified: 2012-01-28 21:55 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Steve Murphy 2004-03-20 10:07:04 UTC
The time is come. I suggest this enhancement to Evolution:

Integrate with Asterisk, the Open Source PBX.

Right now, when I (in Evo 1.3.92 aka 1.4) hit the right button while the
cursor is parked on an email address, it gives me (if there is an address
book entry) a small popup with the name, phone, etc, and an "Edit Contact"
button. 

As a minimum:
I propose that, if there exists any setup information in Evolution for
Asterisk, and any phone numbers are associated with this address book 
entry, that another button be added, "Dial this Contact". If this
button is clicked, and there exist multiple phones, another popup 
should list all possible phone numbers for that contact, and then
dial the selected number.

Now, Asterisk has two methods whereby it can be triggered to 
make a phone call pair, and bridge the two: The Manager interface,
which is via a network port on the asterisk server, or by tossing
a call file into its spool directory (/var/spool/asterisk/outgoing).

Both methods require a small subset of information:

1. The "Channel" or asterisk "device" that corresponds to the caller's
   extension. This can be a hardwired phone (like Zap/13), or a 
   VOIP phone on the network (SIP/Joe), or whatever. 
   --- If you want to use a phone to call someone, you'll have to
   tell Asterisk which phone you want to dial out on. Usually that 
   will the one right next to your computer when you click.
   The user should be able to get this from the PBX admin.

2. The "Context" name that is normally associated with the caller's
   extension. This is assigned by the phone system Admin. Basically,
   it points to a node in the dialplan, that explains what do
   when the phone is picked up.

3. The Number to dial to reach the target. This number may have to
   be processed a bit from the number in the address book. For 
   instance, the local area code may have to be stripped. A dialing
   prefix, like "9", may have to be inserted, to get an outside 
   line. Yes, this gets a little involved. Evolution may have to 
   store information on the country code, local area code, and the
   3-digit prefixes that are considered local, etc, to properly
   build the "real" number to dial.

4. The "Priority" to use with the extension dialed. This will
   most likely be the number 1, but the Asterisk Admin may advise
   otherwise.


Using the "Manager" interface:

Asterisk listens on port 5038 for manager connections. Uh, I guess
this could be different site to site, so the port number needs to be a 
user-settable option. 

To use this 
interface, the Asterisk Admin will have to assign the user an account
name and Password. These values will have to be stored within
Evolution. Evolution will then open a telnet-like connection to 
port 5038, and Send these commands in Plain text:

Action: Login
Username: <user acct name on the Asterisk Switch)
Secret: <password>
<blank line>

(The blank line is an indication that all the command info has been
provided, and it should get about its business.)
Oh, and yes, the Secret: Password can also be encrypted. Check
the Asterisk documentation for this stuff.

Then this is sent:

Action: Originate
Channel: <Callers channel name>
Context: <context name>
Exten: <number to dial, exactly as it would have dialed from the phone>
Priority: <number>
<blank line>

Then, the following:

Action: Logoff
<blank line>

Asterisk will tend to babble all sorts of stuff over this connection.
All of it should be absorbed and ignored, as some will most
certainly be a direct response to the commands above, and some will
just be stuff going on in the PBX, that it reports to managers,
that doesn't mean anything to this conversation.

Examples of what it will spit out:

Event: Newchannel
Channel: Zap/6-1
State: Rsrvd
Callerid: Joe <9990009999999>
Uniqueid: lskdfjasdklfj

Event: Newstate
Channel: Zap/6-1
State: Ringing
Callerid: Joe <9990009999999>
Uniqueid: lskdfjasdklfj

Event: Newexten
Channel: Zap/6-1
Context: workext
Priority: 1
Uniqueid: lskdfjasdklfj

Event: Newchannel
Channel: Zap/2-1
State: Rsrvd
(blah)

Event: Newstate
Channel: Zap/2-1
State: Dialing
Callerid: Joe <9990009999999>
(blah)

Response: Success
Message: Originate successfully queued.

Event: Newstate
Channel: Zap/2-1
State: Up
(blah)

Event: Link
(blah)

The last, Logoff command should leave you with EOF on the
session.

What does all this mean? Well it means that first off, Asterisk
will ring your extension, and wait. When you pick up the phone,
it will continue to its next task, dialing the number you want.
It then bridges (connects) you and the outgoing call on the other
interface together. You begin hearing the phone ringing at the
other end.


The other Method: Using the Call spool file.

In this scenario, the Evolution user has some kind of direct
access to the spool dir on the Asterisk server machine. Maybe
via NFS mount, maybe via rcp or something. Who knows.

Anyway, Evolution will build a file in a temp dir, that 
follows this format:

Channel: <callers' extension, like Zap/6>
Context: <context name, like "workext">
Extension: <number to dial, same as above>
Priority: <number, most likely "1">

(other information, like MaxRetries:,  WaitTime:, etc. 
are available, also.... )

this file is then copied to the dir "/var/spool/asterisk/outgoing", 
on the Asterisk server. This directory path should probably 
be stored in Evolution, with the default set up to be this 
path, I guess.

In a few moments, if all is accurate, your phone will ring.
When you pick it up, you will hear the ring tones for the
party you wanted to dial. Magic.

==============================
Now, as to which will be the best Method to use, I'd
imagine that the Asterisk Admin would know. If you can only
supply one, using port 5038 is most likely the most universal
of the two.

Why do this? Because it will be way cool. It's just crying to
be done. If you are lucky enough to have a site that uses
Asterisk, to have PBX integration, and be able to initiate an
outgoing call with a button click, is a KILLER app!

I'm sure a little glue logic outside Evolution would allow
other (non-open-source) PBX's with such call-initiation support,
to be used.

Marketing guys should love this sort of thing! They can boast
that Evolution has autodial support, the end user can
"point and click" to initiate a call thru an Asterisk PBX, etc. etc.
The Msoft guys will be green with envy. MSoft don't have no 
such software. Maybe they can retaliate with some interface to
fire a call via a cisco call manager or something. Who knows. Even
so, you still got in the first punch.
Comment 1 André Klapper 2005-07-19 18:13:42 UTC
as discussed with nags, changing component to "Misc" to get rid of the UI 
component, also reassign to Misc-assignee.
Comment 2 C de-Avillez 2008-07-10 19:57:20 UTC
Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/evolution/+bug/246085

This sounds really nice...
Comment 3 C de-Avillez 2008-07-10 19:58:13 UTC
Updating Evo version
Comment 4 André Klapper 2012-01-28 20:09:21 UTC
I rather see Ekiga or Empathy for this kind of job today, but not Evolution...
Comment 5 Matthew Barnes 2012-01-28 21:55:19 UTC
(In reply to comment #4)
> I rather see Ekiga or Empathy for this kind of job today, but not Evolution...

I agree.  Closing.