Summary:ASTERISK-05228: [patch] [post 1.2] Asterisk Messaging with Dialog Emulation Support
Reporter:Joshua C. Colp (jcolp)Labels:
Date Opened:2005-10-03 16:18:45Date Closed:2011-06-07 14:03:03
Versions:Frequency of
Environment:Attachments:( 0) asterisk-messaging-0.0.3_mod_x-files.tgz
( 1) asterisk-messaging-0.0.3.gz
( 2) asterisk-messaging2-0.0.1.patch
Description:So folks,

People have wanted messaging support internally for ages - here it is, but use at your own risk. People will agree that this has been done in a suvere way - yes, I agree but the core is so oriented around voice it's not funny. Included is also a demonstration application to show people how it actually works. Essentially it adds a content type integer to the channel structure that stuff can check to say "hey - this is messaging, or hey - this is voice!". The res_messaging module implements rudimentary dialog support. It could use it's own thread that would kill old messaging sessions that haven't been used in awhile. </tangent>

For messaging between phones you shouldn't need to modify your dialplan at all. Just send a message to the person's extension, Dial will fire up a messaging based channel (the content type is inherited), and queue up a message.

chan_sip has also been modified so that if the client supports it, it'll know when the person is typing - it'll simply disregard the state as 1. How would you convey that across protocols? and 2. It uses an XML encoded scheme to say the typing status.


Any comments/questions/bugs/etc fire them up on here and I'll answer to the best of my ability. Any feature requests, hey - I'm always open to writing new things.

Comments:By: Joshua C. Colp (jcolp) 2005-10-03 16:23:53

Okay let's start another rant - what would everyone say to a message queue inside of res_messaging that would be able to store messages for clients that are not online? Something would definitely have to be thought of for storage on a disk level though (sqlite? astdb?). </rant>

By: twisted (twisted) 2005-10-03 23:11:06


By: Olle Johansson (oej) 2005-10-04 01:55:31

Yes, a message silo would be a good thing. Maybe configurable per user/account.

By: Olle Johansson (oej) 2005-10-04 02:00:19

We should always be aware of character sets used in messaging. SIP messaging is UTF8, right?

By: Olle Johansson (oej) 2005-10-04 02:13:07

In this patch, you remove app_externalivr and app_directed_pickup from the apps/makefile...

By: Olle Johansson (oej) 2005-10-04 02:21:03

A few more comments:
* You need to document which xml library you use. Btw, this addition will be hard to get approved by Mark... ;-) We do need it for PUBLISH.
* You add support to PUBLISH, which to me is not messaging but status info. Please explain. (it's not added to the supported methods header). I must have missed something here.
* What if Asterisk sends a text message and is authenticated? Asterisk to asterisk messaging?
* You use "in-call" where I normally talk about "within SIP dialog" or "outside of SIP dialog". You are in my words adding support for "MESSAGE outside of an established SIP dialog".
* I think we would need a dialplan function to be able to separate execution of text-only calls in the dialplan. Sending a voice call to chatroom does not make sense, as does not sending a text-channel to meetme.
* We need to have a media-type and character-set attribute to the message. At some point, people will send WML messages encoded in EBCDIC...

By: Joshua C. Colp (jcolp) 2005-10-05 11:27:25

I shall update/prune/etc this weekend... and you never saw what you think you saw... mmmk?

By: Olle Johansson (oej) 2005-10-05 11:35:44

Let's discuss this at Astricon :-)

By: Joshua C. Colp (jcolp) 2005-10-05 11:51:06

See that would make sense, if I was going - but sadly I'm not as I'm not made of money. Thus if anyone wants to donate - quickly - to some sort of fund to get me to Astricon so oej and I can talk SIP meh we'd be appreciative? mmmkthx peace

By: Donny Kavanagh (donnyk) 2005-10-19 00:37:13

How is this progressing?

By: Romualdo Arcoverde (romualdo) 2005-11-30 15:37:10.000-0600

Hi, i could not apply the patch on 1.2 stable, do you u have one new version??
thanks Romualdo

By: Joshua C. Colp (jcolp) 2005-11-30 15:59:43.000-0600

I'll be putting an updated version into SVN soon for general consumption... note it's a proof of concept thing and a discussion definitely has to occur over how to decentralize the concept of a channel carrying voice instead of a general media.

By: Romualdo Arcoverde (romualdo) 2005-12-12 08:16:16.000-0600

Josh, do you have a new version?? because a could no apply this patch on 1.2 stable?? sorry ask again the same think but i would like to try your patch.

Thanks Romualdo

By: Matt O'Gorman (mogorman) 2006-01-13 00:16:27.000-0600

file do you have your own repo for this now thats more upto date? i am intrested in playing with it for my stuff... how is it progressing?

By: X-Files (x-files) 2006-01-22 19:24:20.000-0600


asterisk-messaging-0.0.3_mod_x-files.tgz For * 1.2.2

Worked !

By: Softwaremafia (softwaremafia) 2006-01-31 03:37:42.000-0600

I have installed the messeging patch and just trying to send the instant message among windows messenger 5.1 and softphone snom 360 but some how message is not forwarded on the phone althoug asterisk reply the messenger client (sending the message ) with 200 OK
so could you help me out in this
The message appears on asterisk consol is
Executing Dial("SIP/123-722f", "SIP/12345") in new stack [TEXT]
   -- Called 12345
   -- SIP/12345-918f answered SIP/123-722f
   -- Attempting native bridge of SIP/123-722f and SIP/12345-918f

where 12345 is the extension for snom 360 phone and 123 is the extension for Windows messenger client

By: linx (linxroute) 2006-02-03 23:34:16.000-0600

i'm very much a newbie to asterisk , would some one please be so kind such as instruct me how to apply the asterisk-messaging patch ? i've read the instruction but still , no success at all.
the Patch command is patch -1p < file name ? or do i have to change the file .patch to diff , many thanks

By: roman sidler (rsidler) 2006-02-15 10:09:21.000-0600

Thanks for the work
I adapted it to my 1.0.9-Asterisk it works

a) doesn't this leads to a race condition.
(The reach of a Dial() with content==1 is accidentally)
the patch
owner = sip_new(p, AST_STATE_UP,..
owner->content = 1; /* Switch to text mode */
owner->nativeformats = 0; /* Disable native formats */isable native formats */
my version:
owner = sip_new(p, AST_STATE_DOWN,
owner->content = 1; /* Switch to text mode */
owner->nativeformats = 0; /* Disable native formats */
p->owner = owner;
ast_channel_setwhentohangup(p->owner, 2000); /*wait a while in the bridge*/
owner->_state =  AST_STATE_UP; /*avoid to trigger state notification*/
ast_pbx_start(owner); /*go on into dialplan*/
b) Am I right there is no termination of the bridge? In my version above I added a timeout. This works, but has the drawback of signalled Hangup (here BYE).
c) I'm astonished to lead the instant message into the bridge. Is it in dial_exec() not more suitable to fork it into a res_messaging function before ast_call() . So it could be handled out of xxx_call functions. In the moment the bridge waits just for the confirmation of the message.

By: roman sidler (rsidler) 2006-02-22 16:10:22.000-0600

Inspired by joshnet I made a minimal invasive version of instant messaging:

  asterisk-messaging2-0.0.1.patch (svn_trunk update 02/23/06)

No bridge, no ast_call() affected, no codec  stuff affected.
I introduced a single threaded message-poster, in res_messaging.c. This acts as background thread and gives control to limit the load on asterisk (?).

The chatroom doesn't work with this patch.
After every transmission channels and SIP-dialogs are freed.
Message receiving just on SIP, transmitting should work on all technologies.


By: Olle Johansson (oej) 2006-04-04 08:47:50

How do we proceed with this? We need a decision from Mark on how to handle text-only-channels. From that point, we can start working on the new architecture.

By: Joshua C. Colp (jcolp) 2006-05-05 13:14:44

I'm going to suspend my own note until we can open a discussion with Mark about how this should be handled, and leave it for 1.6.