Re: [asterisk-users] Message waiting question...

2006-07-31 Thread Jean-Yves Avenard

Hi

For those interested.
I've ported the following solution:
http://bugs.digium.com/view.php?id=4236
for asterisk 1.2.10

it works well.
To activate MWI over IAX2 add the following line in sip.conf or
zaptel.conf etc...

mailbox=IAX2/{iax2_context}/[EMAIL PROTECTED]

For some weird reason though, on my panasonic while I can hear the
message waiting tone, the little enveloppe icon doesn't appear on the
phone
The patch against 1.2.10 is attached to this email.

I have also ported this solution:
http://bugs.digium.com/view.php?id=4371
to asterisk 1.2.10 if anyone is interested.. It's more powerful but
much more complicated to configure ...

Jean-Yves

On 7/31/06, Jean-Yves Avenard [EMAIL PROTECTED] wrote:

Hi

On 7/27/06, Luki [EMAIL PROTECTED] wrote:
 There is this old patch that does remote MWI over IAX (among other
 things). I used it on earlier versions and it worked quite nicely.
 This was before 1.2 so it may no longer work at all. At the very least
 it will likely required some updating. Doable, just depends how much
 time you want to put into it :).

I think I got it working with Asterisk 1.2.10. I can see the mailbox
information being sent between the two servers.
However, my SPA3000 is still not getting the MWI properly. I believe
that the problem is with the configuration file. I'm not sure I fully
understand the information provided: in the bug report there are
several conflicting setup and I'm not sure which one is good.

Setup being:
SPA3000 -(SIP) Asterisk1 ---(IAX2) Asterisk2
and I want SPA3000 to check if there's voicemail waiting on Asterisk2.

On Asterisk2:
in iax.conf I have:
[iax_peer_name_to_asterisk1]
type=friend
mailbox=500
host=dynamic
...

in voicemail.conf
voicemail_server=iax_peer_name_to_asterisk1

[default]
[EMAIL PROTECTED] = password,email etc..

On Asterisk1:
iax.conf:
[iax_peername_to_asterisk2]
type=friend
username=iax_peer_name_to_asterisk1
secret=..
host=asterisk2_hostname

sip.conf:
[spa3000]
mailbox=500:[EMAIL PROTECTED]


Am I correct?
I haven't digged too much in the source code, I'm starting to have a
good understanding but any help would be appreciated.

JY

diff -r -u asterisk-1.2.10/app.c asterisk-wmi.patch/app.c
--- asterisk-1.2.10/app.c	2006-07-13 01:46:56.0 +1000
+++ asterisk-wmi.patch/app.c	2006-08-01 03:02:08.0 +1000
@@ -232,6 +232,8 @@
 
 static int (*ast_has_voicemail_func)(const char *mailbox, const char *folder) = NULL;
 static int (*ast_messagecount_func)(const char *mailbox, int *newmsgs, int *oldmsgs) = NULL;
+static int (*ast_iax_has_voicemail_func)(const char *mailbox, const char *folder) = NULL;
+static int (*ast_iax_messagecount_func)(const char *mailbox, int *newmsgs, int *oldmsgs) = NULL;
 
 void ast_install_vm_functions(int (*has_voicemail_func)(const char *mailbox, const char *folder),
 			  int (*messagecount_func)(const char *mailbox, int *newmsgs, int *oldmsgs))
@@ -246,35 +248,135 @@
 	ast_messagecount_func = NULL;
 }
 
+void ast_install_iax_vm_functions(int (*iax_has_voicemail_func)(const char *mailbox, const char *folder),
+			  int (*iax_messagecount_func)(const char *mailbox, int *newmsgs, int *oldmsgs))
+{
+	ast_iax_has_voicemail_func = iax_has_voicemail_func;
+	ast_iax_messagecount_func = iax_messagecount_func;
+}
+
+void ast_uninstall_iax_vm_functions(void)
+{
+	ast_iax_has_voicemail_func = NULL;
+	ast_iax_messagecount_func = NULL;
+}
+
 int ast_app_has_voicemail(const char *mailbox, const char *folder)
 {
-	static int warned = 0;
-	if (ast_has_voicemail_func)
-		return ast_has_voicemail_func(mailbox, folder);
-
-	if ((option_verbose  2)  !warned) {
-		ast_verbose(VERBOSE_PREFIX_3 Message check requested for mailbox %s/folder %s but voicemail not loaded.\n, mailbox, folder ? folder : INBOX);
-		warned++;
+	static int loc_warned = 0;
+	static int iax_warned = 0;
+	char *workspace, *mbp, *comma;
+	int ret = 0;
+
+	if (!mailbox)
+		return 0;
+
+	workspace = mbp = strdup(mailbox);
+	if (!workspace)
+		return 0;
+
+	while (*mbp) {
+		if ((comma = strchr(mbp, ',')))
+			*comma++ = '\0';
+
+		if (strncasecmp(iax2/, mbp, 5) == 0) {
+			if (!ast_iax_has_voicemail_func) {
+if (!iax_warned  (option_verbose  2)) {
+	ast_verbose(VERBOSE_PREFIX_3 Message check requested for %s/folder %s but IAX voicemail checks not loaded.\n, mailbox, folder ? folder : INBOX);
+	iax_warned++;
+}
+ret = 0;
+			} else
+ret = ast_iax_has_voicemail_func(mbp + 5, folder);
+		} else {  /* local voicemail system check */
+			if (!ast_has_voicemail_func) {
+if (!loc_warned  (option_verbose  2)) {
+	ast_verbose(VERBOSE_PREFIX_3 Message check requested for mailbox %s/folder %s but voicemail checks not loaded.\n, mailbox, folder ? folder : INBOX);
+	loc_warned++;
+}
+ret = 0;
+			} else
+ret = ast_has_voicemail_func(mbp, folder);
+		}
+
+		if (ret)
+			break;
+
+		if (comma)
+			mbp = comma;
+		else
+			break;
 	}
-	return 0;
-}
 
+	free(workspace);
+	return ret;
+}
 
 int 

Re: [asterisk-users] Message waiting question...

2006-07-30 Thread Jean-Yves Avenard

Hi

On 7/27/06, Luki [EMAIL PROTECTED] wrote:

There is this old patch that does remote MWI over IAX (among other
things). I used it on earlier versions and it worked quite nicely.
This was before 1.2 so it may no longer work at all. At the very least
it will likely required some updating. Doable, just depends how much
time you want to put into it :).


I think I got it working with Asterisk 1.2.10. I can see the mailbox
information being sent between the two servers.
However, my SPA3000 is still not getting the MWI properly. I believe
that the problem is with the configuration file. I'm not sure I fully
understand the information provided: in the bug report there are
several conflicting setup and I'm not sure which one is good.

Setup being:
SPA3000 -(SIP) Asterisk1 ---(IAX2) Asterisk2
and I want SPA3000 to check if there's voicemail waiting on Asterisk2.

On Asterisk2:
in iax.conf I have:
[iax_peer_name_to_asterisk1]
type=friend
mailbox=500
host=dynamic
...

in voicemail.conf
voicemail_server=iax_peer_name_to_asterisk1

[default]
[EMAIL PROTECTED] = password,email etc..

On Asterisk1:
iax.conf:
[iax_peername_to_asterisk2]
type=friend
username=iax_peer_name_to_asterisk1
secret=..
host=asterisk2_hostname

sip.conf:
[spa3000]
mailbox=500:[EMAIL PROTECTED]


Am I correct?
I haven't digged too much in the source code, I'm starting to have a
good understanding but any help would be appreciated.

JY
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Message waiting question...

2006-07-29 Thread Jean-Yves Avenard

Hi


On 7/27/06, Luki [EMAIL PROTECTED] wrote:

There is this old patch that does remote MWI over IAX (among other
things). I used it on earlier versions and it worked quite nicely.
This was before 1.2 so it may no longer work at all. At the very least
it will likely required some updating. Doable, just depends how much
time you want to put into it :).


Thank you for this link, very interesting. I've started porting it on
Asterisk 1.2.

For it to work, do you need to use two patched Asterisk on either
side? or only on the machine wanting to retrieve the MWI status ?

Thanks
JY
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Message waiting question...

2006-07-28 Thread Jean-Yves Avenard

Hi

On 7/27/06, Joshua Colp [EMAIL PROTECTED] wrote:

I don't believe there's anything configurable but if you open app_voicemail.c 
there's two declarations, VOICEMAIL_DIR_MODE and VOICEMAIL_FILE_MODE which set 
the permissions. DIR mode is at 0770 right now and FILE mode is at 0660.


Hum.. Weird then, on my maching the file mode is definitely 0600 .. I
used the ATrpm package for Fedora Core 5...

JY
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Message waiting question...

2006-07-27 Thread Luki

Anyhow, Asterisk1 and Asterisk2 are connected using IAX2.
What I would like is to have the SPA3000 Message Waiting indicator
based on the voicemail message hosted on the Asterisk2 server.


There is this old patch that does remote MWI over IAX (among other
things). I used it on earlier versions and it worked quite nicely.
This was before 1.2 so it may no longer work at all. At the very least
it will likely required some updating. Doable, just depends how much
time you want to put into it :).

See: http://bugs.digium.com/view.php?id=4371

--Luki
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Message waiting question...

2006-07-27 Thread Joshua Colp
- Original Message -
From: Jean-Yves Avenard
[mailto:[EMAIL PROTECTED]
To: Asterisk Users Mailing List -
Non-Commercial Discussion [mailto:[EMAIL PROTECTED]
Sent:
Thu, 27 Jul 2006 02:07:56 -0300
Subject: Re: [asterisk-users] Message
waiting question...


 Hi
 
 
 On 7/27/06, Joshua Colp [EMAIL PROTECTED] wrote:
  chan_sip requests the count fairly frequently, dunno how much traffic it
 would actually generate though.
 
 Well I took the very easy route.
 
 Every minute I do a rsync between server2 and server1 of the INBOX
 directory I want to check. I also only transfer the .txt file so it
 never needs to transfer more than 500 bytes max every minute. Having
 just the .txt file is sufficient for Asterisk to tell the SPA3000 that
 there's a message waiting.
 
 And best of all: it works :)

As long as it works - that's great!

 As a side question, is there a way to force asterisk to set specific
 group permission on the file generated for the voicemail? I found some
 patches for earlier version of Asterisk and at one stage that it made
 its way into asterisk trunk I can't find any documentation about
 how to configure it though.

I don't believe there's anything configurable but if you open app_voicemail.c 
there's two declarations, VOICEMAIL_DIR_MODE and VOICEMAIL_FILE_MODE which set 
the permissions. DIR mode is at 0770 right now and FILE mode is at 0660.

 Thanks
 JY

Joshua Colp
Digium
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Message waiting question...

2006-07-26 Thread Jean-Yves Avenard

Hi

I have the following setup:

SPA3000 (at home) -- Asterisk1 server (at home) --- Asterisk2 server
(at work).

The reason the SPA3000 isn't connected directly to Asterisk server 2
is because the SPA3000 can't register to more than one SIP account at
a time, plus it was more fun that way :)

Anyhow, Asterisk1 and Asterisk2 are connected using IAX2.
What I would like is to have the SPA3000 Message Waiting indicator
based on the voicemail message hosted on the Asterisk2 server.

Is this possible?
Thanks
JY
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Message waiting question...

2006-07-26 Thread Joshua Colp
- Original Message -
From: Jean-Yves Avenard
[mailto:[EMAIL PROTECTED]
To: Asterisk Users Mailing List -
Non-Commercial Discussion [mailto:[EMAIL PROTECTED]
Sent:
Wed, 26 Jul 2006 11:19:34 -0300
Subject: [asterisk-users] Message waiting
question...


 Hi

Hola!

 I have the following setup:
 
 SPA3000 (at home) -- Asterisk1 server (at home) --- Asterisk2 server
 (at work).
 
 The reason the SPA3000 isn't connected directly to Asterisk server 2
 is because the SPA3000 can't register to more than one SIP account at
 a time, plus it was more fun that way :)

Fun is good!

 Anyhow, Asterisk1 and Asterisk2 are connected using IAX2.
 What I would like is to have the SPA3000 Message Waiting indicator
 based on the voicemail message hosted on the Asterisk2 server.
 
 Is this possible?

Anything is possible, it's just to what extreme do you want to go to make it 
happen. Right now we have no way of transporting arbitrary information (like 
MWI status) between servers. In the future however I'm hoping we'll have 
something. For now there's two er I mean three ways off the top of my head you 
could approach this.

1. Using ODBC storage to store your voicemail in a database and have each 
server setup against that database. The MWI will just query the database to see 
if there are messages, and since there will be... MWI will be sent to the phone.

2. Using the ability to execute an outside application that exists right now 
and using your own method to communicate back to turn on MWI (maybe generating 
a SIP NOTIFY to poke the phone with?).

3. Share the voicemail directory over something like NFS.

 Thanks
 JY

Joshua Colp
Digium
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Message waiting question...

2006-07-26 Thread Brandon Galbraith
Might be easier to share the directory over WebDAV. Only need to have one port open on the work firewall (if in place) to allow access and can also run it over SSL.-brandonOn 7/26/06, 
Joshua Colp [EMAIL PROTECTED] wrote:
- Original Message -From: Jean-Yves Avenard[mailto:[EMAIL PROTECTED]]To: Asterisk Users Mailing List -Non-Commercial Discussion [mailto:
asterisk-users@lists.digium.com]Sent:Wed, 26 Jul 2006 11:19:34 -0300Subject: [asterisk-users] Message waitingquestion... HiHola! I have the following setup:
 SPA3000 (at home) -- Asterisk1 server (at home) --- Asterisk2 server (at work). The reason the SPA3000 isn't connected directly to Asterisk server 2 is because the SPA3000 can't register to more than one SIP account at
 a time, plus it was more fun that way :)Fun is good! Anyhow, Asterisk1 and Asterisk2 are connected using IAX2. What I would like is to have the SPA3000 Message Waiting indicator based on the voicemail message hosted on the Asterisk2 server.
 Is this possible?Anything is possible, it's just to what extreme do you want to go to make it happen. Right now we have no way of transporting arbitrary information (like MWI status) between servers. In the future however I'm hoping we'll have something. For now there's two er I mean three ways off the top of my head you could approach this.
1. Using ODBC storage to store your voicemail in a database and have each server setup against that database. The MWI will just query the database to see if there are messages, and since there will be... MWI will be sent to the phone.
2. Using the ability to execute an outside application that exists right now and using your own method to communicate back to turn on MWI (maybe generating a SIP NOTIFY to poke the phone with?).3. Share the voicemail directory over something like NFS.
 Thanks JYJoshua ColpDigium___--Bandwidth and Colocation provided by Easynews.com --asterisk-users mailing list
To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
-- Brandon GalbraithEmail: [EMAIL PROTECTED]AIM: brandong00Voice: 630.400.6992A true pirate starts drinking before the sun hits the yard-arm. Ya. --thelost
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Message waiting question...

2006-07-26 Thread Jean-Yves Avenard

Hi.

Thank you so much for answering. I guess I couldn't get a better
qualified answer !

On 7/27/06, Joshua Colp [EMAIL PROTECTED] wrote:


Anything is possible, it's just to what extreme do you want to go to make it 
happen. Right now we have no way of transporting arbitrary information (like 
MWI status) between servers. In the future however I'm hoping we'll have 
something. For now there's two er I mean three ways off the top of my head you 
could approach this.



Hum... I'm afraid that what I was expecting 


1. Using ODBC storage to store your voicemail in a database and have each 
server setup against that database. The MWI will just query the database to see 
if there are messages, and since there will be... MWI will be sent to the phone.


This may be a disturbing solution, I have over 30 voicemail on server2
and I guess I would have to convert all of them first.
This may be the easiest solution if you can set up a database
voicemail for one user only...



2. Using the ability to execute an outside application that exists right now 
and using your own method to communicate back to turn on MWI (maybe generating 
a SIP NOTIFY to poke the phone with?).


That sounds quite complicated...



3. Share the voicemail directory over something like NFS.

How often does asterisk check the content of the voicemail directory?
the two machines connect over a 512kbit/s link, I'm afraid there could
be a bandwidth problem.

JY
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Message waiting question...

2006-07-26 Thread Joshua Colp
- Original Message -
From: Jean-Yves Avenard
[mailto:[EMAIL PROTECTED]
To: Asterisk Users Mailing List -
Non-Commercial Discussion [mailto:[EMAIL PROTECTED]
Sent:
Wed, 26 Jul 2006 22:23:01 -0300
Subject: Re: [asterisk-users] Message
waiting question...

 
  1. Using ODBC storage to store your voicemail in a database and have each
 server setup against that database. The MWI will just query the database to
 see if there are messages, and since there will be... MWI will be sent to
 the phone.
 
 This may be a disturbing solution, I have over 30 voicemail on server2
 and I guess I would have to convert all of them first.
 This may be the easiest solution if you can set up a database
 voicemail for one user only...

It's all or nothing when it comes to this stuff. If you choose database, every 
user must use it. It basically takes over the relevant parts of app_voicemail 
when you compile it in.

 
 
  2. Using the ability to execute an outside application that exists right
 now and using your own method to communicate back to turn on MWI (maybe
 generating a SIP NOTIFY to poke the phone with?).
 
 That sounds quite complicated...

It's sort of complicated and ugly... yeah

 
 
  3. Share the voicemail directory over something like NFS.
 How often does asterisk check the content of the voicemail directory?
 the two machines connect over a 512kbit/s link, I'm afraid there could
 be a bandwidth problem.

chan_sip requests the count fairly frequently, dunno how much traffic it would 
actually generate though.

 JY

Joshua Colp
Digium
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Message waiting question...

2006-07-26 Thread Jean-Yves Avenard

Hi


On 7/27/06, Joshua Colp [EMAIL PROTECTED] wrote:

chan_sip requests the count fairly frequently, dunno how much traffic it would 
actually generate though.


Well I took the very easy route.

Every minute I do a rsync between server2 and server1 of the INBOX
directory I want to check. I also only transfer the .txt file so it
never needs to transfer more than 500 bytes max every minute. Having
just the .txt file is sufficient for Asterisk to tell the SPA3000 that
there's a message waiting.

And best of all: it works :)

As a side question, is there a way to force asterisk to set specific
group permission on the file generated for the voicemail? I found some
patches for earlier version of Asterisk and at one stage that it made
its way into asterisk trunk I can't find any documentation about
how to configure it though.

Thanks
JY
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users