Hello,

as you can possibly see from the code, if it doesn't find prompt for caller, callee is used. The patch is also only for the version that loads announcement from DB, not the one from file.

Are you sure that the new module is executed? e.g. have you installed sems from package before, and it is still using modules from /usr/lib/sems/ and not /usr/local/lib/sems/?

if you look at the log (set loglevel to debug/3), what does it say "Query string <...>"?

You can also add some more debugging info, as in the attached version of the patch.

Regards
Stefan


Albert Paijmans wrote:
Hi Stefan,

I have tried the patch, so first tar -zxvf, then patch -p0 < earlyannounce.patch in /apps/early_announce
make all, make install.

But the audio file is still the dialed number and not caller id number
When I tried to do the dsm script I could not hear anything at all.

Is there something I am missing? Should I load certain plugins? Tried it with loadig dsm to.

Thanks Albert

On Tue, May 18, 2010 at 2:35 PM, Stefan Sayer <[email protected] <mailto:[email protected]>> wrote:


    Hi,

    you can just save the patch in a file and do
     patch -p0 < early_announce_use_caller.patch
    in apps/early_announce directory.

    Or you can add the code manually:


    Albert Paijmans wrote:

        Hi Stefan,

        Thanks for the reply really happy with it (i am not a programmer
        you know)
        I add #include "AmUriParser.h"  When I kooked at
        EarlyAnnounce.cpp I found the line: if (language.empty())
        language = DefaultLanguage;  Then I add this beneath it right?
        Do I keep the lines following if

    right


        (!announce_file.empty untill #else? I suppose I should replace
        untill #else? And about the dsm script, I use this patch first
        and if it

    in the patch, the lines which start with a + should be added. the
    other lines are just for context (so that the patch program knows
    where to insert what). so, you keep the code from
    get_announce_msg(AnnounceApplication, AnnounceMessage, req.user, ....


        doesn't work I could use the dsm script? Maybe a stupid question
        the dsm script is after compiling normal make / make install
         But where can I find or replace this script?

    save it somewhere (e.g. dsmearlyannounce.dsm in
    /usr/local/lib/sems/dsm/ or /usr/sems/dsm/scripts), then set the
    configuration in /etc/sems/etc/dsm.conf  - diag_path and
    load_diags=dsmearlyannounce . you may also set
    register_apps=dsmearlyannounce
    and then in sems.conf application=dsmearlyannounce.

    or you set in sems.conf application=dsm and in dsm.conf
    inbound_start_diag=dsmearlyannounce.

    in dsm.conf you also need to set run_invite_event=yes

    hth
    Stefan


        A million thanks


        Albert

        +    AmUriParser parser;
        +    parser.uri = req.from_uri;
        +    if (parser.parse_uri()) {
        +      get_announce_msg(AnnounceApplication, AnnounceMessage,
        parser.uri_user,
        +                      parser.uri_host, "", &announce_file);
        +      if (!announce_file.empty()) goto end;
        +    }
        +
           get_announce_msg(AnnounceApplication, AnnounceMessage, req.user,
                           req.domain, "", &announce_file);
           if (!announce_file.empty()) goto end;








        On Mon, May 17, 2010 at 5:53 PM, Stefan Sayer
        <[email protected]
        <mailto:[email protected]>
        <mailto:[email protected]
        <mailto:[email protected]>>> wrote:

           Hi,

           you can use the small patch below to try from user/domain first
           before trying request uri user/domain.

           alternatively, try a small DSM script, a combination of
           test_dbfile.dsm and early_media.dsm (warning, untested):
           ------------------------------------------
           import(mod_dlg);
           import(mod_mysql);
           import(mod_uri);

           initial state START ;
           transition "on invite" START - invite -> runinvite;
           transition "on sess start" START - sessionStart -> runstart;

           state runinvite
                enter {
                 -- we don't want to have the default 200 OK reply
                 set(reply_request=0);
                };

           state runstart
                enter {
                 dlg.acceptInvite(183, progress);
                 connectMedia();
                 uri.parse(@remote_uri, "from.");
                 mysql.playDBAudio("SELECT audio FROM audio WHERE
           name=$from.user", anything.wav);
                 setTimer(1, 10);
                };

           transition FR runstart - timerTest(#id==1) /
             dlg.reply(500, denied);
             stop
            -> FIN;

           transition bye runstart - hangup / stop -> FIN;

           state FIN;
           ------------------------------------------


           Index: EarlyAnnounce.cpp
===================================================================
           --- EarlyAnnounce.cpp   (revision 1874)
           +++ EarlyAnnounce.cpp   (working copy)
           @@ -29,6 +29,7 @@
            #include "EarlyAnnounce.h"
            #include "AmConfig.h"
            #include "AmUtils.h"
           +#include "AmUriParser.h"

            #include "sems.h"
            #include "log.h"
           @@ -304,6 +305,14 @@

               if (language.empty()) language = DefaultLanguage;

           +    AmUriParser parser;
           +    parser.uri = req.from_uri;
           +    if (parser.parse_uri()) {
           +      get_announce_msg(AnnounceApplication, AnnounceMessage,
           parser.uri_user,
           +                      parser.uri_host, "", &announce_file);
           +      if (!announce_file.empty()) goto end;
           +    }
           +
               get_announce_msg(AnnounceApplication, AnnounceMessage,
        req.user,
                               req.domain, "", &announce_file);
               if (!announce_file.empty()) goto end;


           hth
           Stefan

           Albert Paijmans wrote:

               Hi,

               I have been playing around with SEMS. I like the
        early_announce
               application with database support. Play an announcement
        to the
               caller.
               But the *wav file is the dialed number and not the caller id.
               It sends an 183 and then 404 not found wich works with a
        proxy.

               Is it possible to have the early_announce application
        play the
               wav file corresponding to caller id? So if extensions
        2345 would
               dial a number it hears 2345.wav and when extension 6789 would
               dial a number it would hear 6789.wav and then the call would
               continu.

               Thanks Albert



------------------------------------------------------------------------


               _______________________________________________
               Sems mailing list
               [email protected] <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>

               http://lists.iptel.org/mailman/listinfo/sems



           --     Stefan Sayer
           VoIP Services Consulting and Development

           Warschauer Str. 24
           10243 Berlin

           tel:+491621366449
           sip:[email protected] <mailto:sip%[email protected]>
        <mailto:sip%[email protected] <mailto:sip%[email protected]>>
           email/xmpp:[email protected]
        <mailto:xmpp%[email protected]>
        <mailto:xmpp%[email protected]
        <mailto:xmpp%[email protected]>>





-- Stefan Sayer
    VoIP Services Consulting and Development

    Warschauer Str. 24
    10243 Berlin

    tel:+491621366449
    sip:[email protected] <mailto:sip%[email protected]>
    email/xmpp:[email protected] <mailto:xmpp%[email protected]>





--
Stefan Sayer
VoIP Services Consulting and Development

Warschauer Str. 24
10243 Berlin

tel:+491621366449
sip:[email protected]
email/xmpp:[email protected]


Index: EarlyAnnounce.cpp
===================================================================
--- EarlyAnnounce.cpp	(revision 1903)
+++ EarlyAnnounce.cpp	(working copy)
@@ -29,6 +29,7 @@
 #include "EarlyAnnounce.h"
 #include "AmConfig.h"
 #include "AmUtils.h"
+#include "AmUriParser.h"
 
 #include "sems.h"
 #include "log.h"
@@ -304,6 +305,24 @@
 
     if (language.empty()) language = DefaultLanguage;
 
+    AmUriParser parser;
+    parser.uri = req.from_uri;
+    if (parser.parse_uri()) {
+      DBG("trying to find announcement for user '%s' domain '%s'\n",
+	  parser.uri_user.c_str(), parser.uri_host.c_str());
+      get_announce_msg(AnnounceApplication, AnnounceMessage, parser.uri_user,
+		       parser.uri_host, "", &announce_file);
+      if (!announce_file.empty()) {
+	DBG("announcement for user '%s' domain '%s' found\n",
+	    parser.uri_user.c_str(), parser.uri_host.c_str());
+	goto end;
+      } else {
+	DBG("announcement for user '%s' domain '%s' not found\n",
+	    parser.uri_user.c_str(), parser.uri_host.c_str());
+      }
+
+    }
+
     get_announce_msg(AnnounceApplication, AnnounceMessage, req.user,
 		     req.domain, "", &announce_file);
     if (!announce_file.empty()) goto end;
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to