ISDN CallerID and MP1.2 (1 Viewer)

HDMS

Portal Member
July 16, 2010
21
10
Christchurch
Home Country
New Zealand New Zealand
Re: External CallerID and MP1.2.1

Ok since there seems to be some discrepancies between the code what I have done is replace the main routine with the modified one from the ex-core callerid (since I have already added the media pause function to it). Make sure you only have this YAC Listener callerid plugin enabled! I've put it into the MP installer to make it easier, it will also install the default images in the thumbs directory.

Also check you only have 1 entry for each IP address in the YAC listener screen that you wish to send the calling information to, if you have the same IP listed multiple times it will send a message multiple times.?
 

Attachments

  • External YAC Listener.mpe1
    83.6 KB

RoChess

Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    Installation via MPEI went smooth, but problem did not go away. I did notice that when IMDb+ plugin popped up notify dialog right when I did a YAC test, that another error showed up in log. To be sure I disabled the IMDb+ plugin and re-ran test, but it made no difference (well aside from the extra error being gone), but it still flashed 9x and not once as expected.

    However I'm hoping that the error that happened when IMDb+ popped up its own notify dialog might help you debug it more (the IMDb+ plugin for example showed no error, nor does it freak out like this when another plugin shows a dialog at the same time). Perhaps you can take a peek at the way IMDb+ plugin handles notify dialogs (doubt it helps, but I had a lot of help on that code -- Function to display notify dialog).

    [collapse]
    2011-12-19 00:14:59.848632 [Debug][BassAudio(7)]: BASS: Finished loading DSP plugins ...
    2011-12-19 00:14:59.868632 [Info.][BassAudio(7)]: BASS: Initializing BASS environment done.
    2011-12-19 00:15:04.875632 [Info.][YAC Listener(15)]: ***** INCOMING CALL: Monday, December 19, 2011 12:15:04 AM *****
    2011-12-19 00:15:04.876632 [Info.][YAC Listener(15)]: Name: YAC Test Call
    2011-12-19 00:15:04.876632 [Info.][YAC Listener(15)]: Number: Call from (425) 555-1212 at 12:15 am
    2011-12-19 00:15:04.876632 [Info.][YAC Listener(15)]: Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2011-12-19 00:15:04.962632 [Debug][YAC Listener(15)]: WindowManager: route WindowPlugins.home.GUIBasicHome:35->MediaPortal.Dialogs.GUIDialogNotify:2016
    2011-12-19 00:15:05.153632 [Debug][YAC Listener(15)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2011-12-19 00:15:11.783632 [Info.][YAC Listener(15)]: GUIWindow: Dispose exception - System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
    at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
    at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
    at System.Collections.Generic.List`1.Enumerator.MoveNext()
    at MediaPortal.ExtensionMethods.ListExtMethods.DisposeAndClearCollection[T](ICollection`1 listInterface)
    at MediaPortal.GUI.Library.GUIWindow.Dispose()
    2011-12-19 00:15:11.784632 [Debug][YAC Listener(15)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->WindowPlugins.home.GUIBasicHome:35
    2011-12-19 00:15:11.930632 [Info.][YAC Listener(15)]: ***** INCOMING CALL: Monday, December 19, 2011 12:15:11 AM *****
    2011-12-19 00:15:11.931632 [Info.][YAC Listener(15)]: Name: YAC Test Call
    2011-12-19 00:15:11.931632 [Info.][YAC Listener(15)]: Number: Call from (425) 555-1212 at 12:15 am
    2011-12-19 00:15:11.931632 [Info.][YAC Listener(15)]: Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2011-12-19 00:15:11.939632 [Debug][YAC Listener(15)]: WindowManager: route WindowPlugins.home.GUIBasicHome:35->MediaPortal.Dialogs.GUIDialogNotify:2016
    2011-12-19 00:15:12.153632 [Debug][YAC Listener(15)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2011-12-19 00:15:13.317632 [Debug][YAC Listener(15)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->WindowPlugins.home.GUIBasicHome:35
    2011-12-19 00:15:13.447632 [Info.][YAC Listener(15)]: ***** INCOMING CALL: Monday, December 19, 2011 12:15:13 AM *****
    2011-12-19 00:15:13.447632 [Info.][YAC Listener(15)]: Name: YAC Test Call
    2011-12-19 00:15:13.448632 [Info.][YAC Listener(15)]: Number: Call from (425) 555-1212 at 12:15 am
    2011-12-19 00:15:13.448632 [Info.][YAC Listener(15)]: Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2011-12-19 00:15:13.459632 [Debug][YAC Listener(15)]: WindowManager: route WindowPlugins.home.GUIBasicHome:35->MediaPortal.Dialogs.GUIDialogNotify:2016
    2011-12-19 00:15:13.638632 [Debug][YAC Listener(15)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2011-12-19 00:15:14.347632 [Debug][YAC Listener(15)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->WindowPlugins.home.GUIBasicHome:35
    2011-12-19 00:15:14.481632 [Info.][YAC Listener(15)]: ***** INCOMING CALL: Monday, December 19, 2011 12:15:14 AM *****
    2011-12-19 00:15:14.481632 [Info.][YAC Listener(15)]: Name: YAC Test Call
    2011-12-19 00:15:14.482632 [Info.][YAC Listener(15)]: Number: Call from (425) 555-1212 at 12:15 am
    2011-12-19 00:15:14.482632 [Info.][YAC Listener(15)]: Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2011-12-19 00:15:14.507632 [Debug][YAC Listener(15)]: WindowManager: route WindowPlugins.home.GUIBasicHome:35->MediaPortal.Dialogs.GUIDialogNotify:2016
    2011-12-19 00:15:14.748632 [Debug][YAC Listener(15)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2011-12-19 00:15:15.384632 [Debug][YAC Listener(15)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->WindowPlugins.home.GUIBasicHome:35
    2011-12-19 00:15:15.517632 [Info.][YAC Listener(15)]: ***** INCOMING CALL: Monday, December 19, 2011 12:15:15 AM *****
    2011-12-19 00:15:15.518632 [Info.][YAC Listener(15)]: Name: YAC Test Call
    2011-12-19 00:15:15.518632 [Info.][YAC Listener(15)]: Number: Call from (425) 555-1212 at 12:15 am
    2011-12-19 00:15:15.518632 [Info.][YAC Listener(15)]: Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2011-12-19 00:15:15.588632 [Debug][YAC Listener(15)]: WindowManager: route WindowPlugins.home.GUIBasicHome:35->MediaPortal.Dialogs.GUIDialogNotify:2016
    2011-12-19 00:15:15.748632 [Debug][YAC Listener(15)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2011-12-19 00:15:16.249632 [Debug][YAC Listener(15)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->WindowPlugins.home.GUIBasicHome:35
    2011-12-19 00:15:16.432632 [Info.][YAC Listener(15)]: ***** INCOMING CALL: Monday, December 19, 2011 12:15:16 AM *****
    2011-12-19 00:15:16.432632 [Info.][YAC Listener(15)]: Name: YAC Test Call
    2011-12-19 00:15:16.432632 [Info.][YAC Listener(15)]: Number: Call from (425) 555-1212 at 12:15 am
    2011-12-19 00:15:16.433632 [Info.][YAC Listener(15)]: Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2011-12-19 00:15:16.451632 [Debug][YAC Listener(15)]: WindowManager: route WindowPlugins.home.GUIBasicHome:35->MediaPortal.Dialogs.GUIDialogNotify:2016
    2011-12-19 00:15:16.667632 [Debug][YAC Listener(15)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2011-12-19 00:15:17.128632 [Debug][YAC Listener(15)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->WindowPlugins.home.GUIBasicHome:35
    2011-12-19 00:15:17.346632 [Info.][YAC Listener(15)]: ***** INCOMING CALL: Monday, December 19, 2011 12:15:17 AM *****
    2011-12-19 00:15:17.346632 [Info.][YAC Listener(15)]: Name: YAC Test Call
    2011-12-19 00:15:17.346632 [Info.][YAC Listener(15)]: Number: Call from (425) 555-1212 at 12:15 am
    2011-12-19 00:15:17.346632 [Info.][YAC Listener(15)]: Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2011-12-19 00:15:17.356632 [Debug][YAC Listener(15)]: WindowManager: route WindowPlugins.home.GUIBasicHome:35->MediaPortal.Dialogs.GUIDialogNotify:2016
    2011-12-19 00:15:17.540632 [Debug][YAC Listener(15)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2011-12-19 00:15:17.959632 [Debug][MPMain(1)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->WindowPlugins.home.GUIBasicHome:35
    2011-12-19 00:15:18.060632 [Info.][YAC Listener(15)]: ***** INCOMING CALL: Monday, December 19, 2011 12:15:18 AM *****
    2011-12-19 00:15:18.060632 [Info.][YAC Listener(15)]: Name: YAC Test Call
    2011-12-19 00:15:18.061632 [Info.][YAC Listener(15)]: Number: Call from (425) 555-1212 at 12:15 am
    2011-12-19 00:15:18.061632 [Info.][YAC Listener(15)]: Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2011-12-19 00:15:18.124632 [Debug][YAC Listener(15)]: WindowManager: route WindowPlugins.home.GUIBasicHome:35->MediaPortal.Dialogs.GUIDialogNotify:2016
    2011-12-19 00:15:18.337632 [Debug][YAC Listener(15)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2011-12-19 00:15:18.834632 [Debug][YAC Listener(15)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->WindowPlugins.home.GUIBasicHome:35
    2011-12-19 00:15:18.969632 [Info.][YAC Listener(15)]: ***** INCOMING CALL: Monday, December 19, 2011 12:15:18 AM *****
    2011-12-19 00:15:18.969632 [Info.][YAC Listener(15)]: Name: YAC Test Call
    2011-12-19 00:15:18.970632 [Info.][YAC Listener(15)]: Number: Call from (425) 555-1212 at 12:15 am
    2011-12-19 00:15:18.970632 [Info.][YAC Listener(15)]: Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2011-12-19 00:15:18.985632 [Debug][YAC Listener(15)]: WindowManager: route WindowPlugins.home.GUIBasicHome:35->MediaPortal.Dialogs.GUIDialogNotify:2016
    2011-12-19 00:15:19.080632 [Debug][YAC Listener(15)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2011-12-19 00:15:19.535632 [Debug][YAC Listener(15)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->WindowPlugins.home.GUIBasicHome:35
    2011-12-19 00:15:21.933632 [Debug][MPMain(1)]: GUIFont:texture disposing:0 debug
    [/collapse]

    Thanks for all the help, I know how irritating it can be when it works fine for you and others are complaining it doesn't work for them :D

    PS: I finally got a look at the source code you provided, and I noticed that the main hook you have is a loop that has a "Thread.Sleep(100);" to add a delay. However I don't see any flags to prevent the same loop from re-activating itself immediatly afterwards if things are asynchrone and with such a small delay it could very well be simply a matter that it fires up the same loop again, as I got a feeling that the only condition being checked "server.Pending()" is still valid at that moment.

    The function doing the actual displaying of the notify dialog seems to be purely "PostYACDialog" and unless I overlooked it in the quick skim, doesn't seem to be referencing itself.

    I'll have a closer look at the source another day and add it to Visual Studio, so I can actually see if my trial and error guesses pay off :)

    I would think adding a debug log entry in the main loop would add a ton of log entries, but at least clear up the mystery if the loop is executed synchrone or asynchrone and if the latter then add a second delay that will properly wait for "server.Pending()" to be cleared when a single call is done.
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    Ok, it took a long time with some trial and error and I'm sure my copy and pasted C# code is not the best way to go about it, but I've solve it for my situation.

    Code:
    if (parsedCall == false)
    {
         Log.Info("failed to parse call");
    }
    else
    {
         Log.Info("correct call, going to sleep until server.Pending() is false");
         while (server.Pending())
         {
              TcpClient flushClient = server.AcceptTcpClient();
              NetworkStream flushStream = flushClient.GetStream();
              StreamReader flushReader = new StreamReader(flushStream);
              inboundRawYACData = flushReader.ReadToEnd();
              flushClient.Close(); // Shutdown and end connection
              Thread.Sleep(1000);
              Log.Info("Flushing: " + inboundRawYACData);
         }
         Log.Info("server.Pending() is cleared, waiting for next call");
    }

    That leads now to the following log entries:

    Code:
    2012-01-04 19:38:24.775600 [Info.][YAC Listener(25)]: ***** INCOMING CALL: Wednesday, January 04, 2012 7:38:24 PM *****
    2012-01-04 19:38:24.776600 [Info.][YAC Listener(25)]:    Name: YAC Test Call
    2012-01-04 19:38:24.776600 [Info.][YAC Listener(25)]:    Number: (425) 555-1212
    2012-01-04 19:38:24.776600 [Info.][YAC Listener(25)]:    Image: C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\YAC\4255551212.jpg
    2012-01-04 19:38:24.777600 [Info.][YAC Listener(25)]: VideoPlayer:Successfully set rate to 1
    2012-01-04 19:38:24.777600 [Info.][YAC Listener(25)]: VideoPlayer:SetRate to:1
    2012-01-04 19:38:24.778600 [Debug][YAC Listener(25)]: VMR9: SetRepaint()
    2012-01-04 19:38:24.795600 [Debug][YAC Listener(25)]: WindowManager: route MediaPortal.GUI.Video.GUIVideoFullscreen:2005->MediaPortal.Dialogs.GUIDialogNotify:2016
    2012-01-04 19:38:24.961600 [Debug][YAC Listener(25)]: DialogWindow: MediaPortal.Dialogs.GUIDialogNotify init
    2012-01-04 19:38:34.840600 [Debug][YAC Listener(25)]: WindowManager: unroute to MediaPortal.Dialogs.GUIDialogNotify:2016->MediaPortal.GUI.Video.GUIVideoFullscreen:2005
    2012-01-04 19:38:34.849600 [Info.][YAC Listener(25)]: VideoPlayer:Successfully set rate to 1
    2012-01-04 19:38:34.850600 [Info.][YAC Listener(25)]: VideoPlayer:SetRate to:1
    2012-01-04 19:38:34.850600 [Info.][YAC Listener(25)]: correct call, going to sleep until server.Pending() is false
    2012-01-04 19:38:34.858600 [Info.][(99)]: planescene:PresentImage() frame:0 enabled:True allowed:False
    2012-01-04 19:38:34.869600 [Debug][MPMain(1)]: VMR9: Repainting -> Playing, Frames: 1
    2012-01-04 19:38:35.850600 [Info.][YAC Listener(25)]: Flushing: @CALLYAC Test Call~(425) 555-1212
    2012-01-04 19:38:36.850600 [Info.][YAC Listener(25)]: Flushing: @CALLYAC Test Call~(425) 555-1212
    2012-01-04 19:38:37.850600 [Info.][YAC Listener(25)]: Flushing: @CALLYAC Test Call~(425) 555-1212
    2012-01-04 19:38:38.855600 [Info.][YAC Listener(25)]: Flushing: @CALLYAC Test Call~(425) 555-1212
    2012-01-04 19:38:39.856600 [Info.][YAC Listener(25)]: Flushing: @CALLYAC Test Call~(425) 555-1212
    2012-01-04 19:38:40.857600 [Info.][YAC Listener(25)]: Flushing: @CALLYAC Test Call~(425) 555-1212
    2012-01-04 19:38:41.857600 [Info.][YAC Listener(25)]: Flushing: @CALLYAC Test Call~(425) 555-1212
    2012-01-04 19:38:42.857600 [Info.][YAC Listener(25)]: Flushing: @CALLYAC Test Call~(425) 555-1212
    2012-01-04 19:38:42.857600 [Info.][YAC Listener(25)]: server.Pending() is cleared, waiting for next call

    Tested it with 10 seconds auto-close of notify setting with pausing of media enabled, and it perfectly paused media, showed dialog once and closed itself to resume media playback.

    No idea why my YAC server sends out 9x the data, because it only shows it once in YAC log and once on all the external YAC listners. Perhaps it is because I got YAC server running on same system as MediaPortal, or the concurrent-RDP hack I've applied, or whatever gremlin.

    Either way it works, so I'm happy :)

    I also changed the way the YAC dialog shows inside MediaPortal.

    Code:
         titlebarStr = "Call at " + currentTime.ToLower() + " from:";
         bodyStr = callernameStr + "\n" + phonenumStr;

    Because I wanted the number and name to be larger and did not care much about the time itself.
     

    Users who are viewing this thread

    Top Bottom