| Author | 
         | 
          
      
        
         
         TonyNo Moderator Group 
          
  
  Joined: December 05 2001 Location: United States
 Online Status: Offline Posts: 2889
          | 
        
         
          
           | Posted: January 25 2007 at 07:42 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
For background info, see this thread.
 
 CID Macro Components
 
 Global Variables: CID, CIDCOUNT
 
 In SETUP macro (COM3):
 
 Formula Post ph_comopen( 4, 3, 9600, "N", 8, 1, 1, 0, 0, 0, 0, 1, 1, "?", "CID" )      
 Formula Post     ph_comsendstring( 4, "at#cid=1\013" )
 
 
 CID Macro:
 
 insert into macroheader values ('CID','CALLER ID',0,0,1);
 insert into macrodetail values ('CID',1,15,'[TEMP1]',NULL,'""',0,'');
 insert into macrodetail values ('CID',2,26,'',NULL,'Next',0,'');
 insert into macrodetail values ('CID',3,15,'[LOCAL1]',NULL,'ph_comrecvchar( 4 )',0,'');
 insert into macrodetail values ('CID',4,15,'[LOCAL2]',NULL,'string( "[LOCAL1]" )',0,'');
 insert into macrodetail values ('CID',5,16,'',NULL,'if( "[LOCAL2]" = "-3", 3, 1)',0,'');
 insert into macrodetail values ('CID',6,15,'[TEMP1]',NULL,'"[TEMP1]" + char( integer( "[LOCAL1]" ))',0,'');
 insert into macrodetail values ('CID',7,27,'',NULL,'"Next"',0,'');
 insert into macrodetail values ('CID',8,15,'[TEMP1]',NULL,'ph_replaceall( "[TEMP1]", "RING", "" )',0,'');
 insert into macrodetail values ('CID',9,16,'',NULL,'if( match( "[TEMP1]", "DATE"), 1, 999)',0,'');
 insert into macrodetail values ('CID',10,37,'',NULL,'Get rid of all <CR><LF>''s',0,'');
 insert into macrodetail values ('CID',11,15,'[TEMP3]',NULL,'ph_replaceall( "[TEMP1]", char(13)+char(10), " " )',0,'');
 insert into macrodetail values ('CID',12,15,'[TEMP1]',NULL,'pos( "[TEMP3]", "NAME = " ) + 7',0,'');
 insert into macrodetail values ('CID',13,15,'[TEMP2]',NULL,'pos( "[TEMP3]", "NMBR = ")',0,'');
 insert into macrodetail values ('CID',14,37,'',NULL,'Get Name',0,'');
 insert into macrodetail values ('CID',15,15,'[LOCAL1]',NULL,'mid( "[TEMP3]", [TEMP1], [TEMP2] - 2 - [TEMP1] )',0,'');
 insert into macrodetail values ('CID',16,37,'',NULL,'Get Number',0,'');
 insert into macrodetail values ('CID',17,15,'[LOCAL2]',NULL,'mid( "[TEMP3]", [TEMP2] + 7, 10 )',0,'');
 insert into macrodetail values ('CID',18,37,'',NULL,'Replace name sent with name listed in cid.ini file, if it exists, if not, use name sent.',0,'');
 insert into macrodetail values ('CID',19,15,'[TEMP1]',NULL,'profilestring ( "c:\program files\powerhome\cid.ini", "names", "[LOCAL2]", "" )',0,'');
 insert into macrodetail values ('CID',20,15,'[LOCAL1]',NULL,'if( "[TEMP1]" = "", "[LOCAL1]", "[TEMP1]")',0,'');
 insert into macrodetail values ('CID',21,38,'',1,'ph_macroparm ( "ANNOUNCE", "[LOCAL1]" + ". call from " + "[LOCAL1]", 5, 0, 0, 0 )',0,'');
 insert into macrodetail values ('CID',22,15,'[LOCAL2]',NULL,'string ( number("[LOCAL2]"), "###-###-####" )',0,'');
 insert into macrodetail values ('CID',23,10,'CID',NULL,'"[LOCAL1]" + " " + "[LOCAL2]" + " " + string( today(),  "mm/dd/yy h:mm am/pm") ',0,'');
 insert into macrodetail values ('CID',24,10,'CIDCOUNT',NULL,'{CIDCOUNT}+1',0,'');
 insert into macrodetail values ('CID',25,1,'CIDLOG',1,'',0,'');
 
 
 CIDLOG Macro:
 
 insert into macroheader values ('CIDLOG','LOG CID INFO',0,0,1);
 insert into macrodetail values ('CIDLOG',1,37,'',NULL,'Write last caller info to raw log file (create the file if not there).',0,'');
 insert into macrodetail values ('CIDLOG',2,38,'',0,'ph_writefile( "c:\program files\powerhome\cid.log", if( ph_fileexists( "c:\program files\powerhome\cid.log") = 1, 0, 1), "{CID}" + "<br><br>" )',0,'');
 insert into macrodetail values ('CIDLOG',3,37,'',NULL,'Load template file',0,'');
 insert into macrodetail values ('CIDLOG',4,15,'[LOCAL1]',NULL,'ph_readfile( "c:\program files\powerhome\cidlog.txt")',0,'');
 insert into macrodetail values ('CIDLOG',5,37,'',NULL,'Load log file',0,'');
 insert into macrodetail values ('CIDLOG',6,15,'[LOCAL2]',NULL,'ph_readfile( "c:\program files\powerhome\cid.log")',0,'');
 insert into macrodetail values ('CIDLOG',7,37,'',NULL,'Insert log data into template file',0,'');
 insert into macrodetail values ('CIDLOG',8,15,'[LOCAL1]',NULL,'ph_replaceall ( "[LOCAL1]", "<CID>", "[LOCAL2]" )',0,'');
 insert into macrodetail values ('CIDLOG',9,37,'',NULL,'Write file to formatted log',0,'');
 insert into macrodetail values ('CIDLOG',10,38,'',0,'ph_writefile( "c:\program files\powerhome\web\cidlog.psp", 1, "[LOCAL1]" )',0,'');
 
 
 cid.ini Format:
 
 [Names]
 1235551212=Tony
 
  Edited by TonyNo - January 28 2007 at 19:14
         | 
        
       
        | Back to Top | 
         
          
          
         | 
        
       
       
        |   | 
       
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: November 26 2007 at 09:24 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Since my VoIP service does not supply the name I have to search my data and fill the name in and log it after that. The CID and CIDLOG macros were of great benefit.. Thanks Tony.    
  __________________ Pete - X10 Oldie
         | 
        
       
        | Back to Top | 
         
          
         | 
        
       
       
        |   | 
       
        
         
         Gadgets Senior Member 
          
  
  Joined: January 28 2008 Location: Canada
 Online Status: Offline Posts: 178
          | 
        
         
          
           | Posted: February 09 2008 at 20:55 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Hey Tony,
 
   Just need to get clear on part of this CID stuff. I now have a modem installed and reporting the CID info as checked with HyperTerminal. So now I'm ready to give this macro stuff a try.
 
  I'm not clear on this part:
 
 CID Macro Components 
 
 Global Variables: CID, CIDCOUNT 
 
 In SETUP macro (COM3): 
 
 Formula Post ph_comopen( 4, 3, 9600, "N", 8, 1, 1, 0, 0, 0, 0, 1, 1, "?", "CID" )       
 Formula Post     ph_comsendstring( 4, "at#cid=1\013" ) 
 
 
 am I making a macro called SETUP with these formulas in them?
  From what I read in your old thread, all the "insert" sections can be done directly through the Multi-editor.. correct?
 
  Also, what is this ph_comsendstring( 4, "at#cid=1\013" ) to enable my CID my string is AT+VCID=1 what are all the other numbers for in that formula?
 
  Just not sure where to start here...
  __________________ Friends, don't let friends install Norton Products
         | 
        
       
        | Back to Top | 
         
          
          
         | 
        
       
       
        |   | 
       
        
         
         TonyNo Moderator Group 
          
  
  Joined: December 05 2001 Location: United States
 Online Status: Offline Posts: 2889
          | 
        
         
          
           | Posted: February 11 2008 at 13:46 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Wow. I just saw this. Stupid forum software.    
 
 Yes, I have a SETUP macro that runs when PH starts. This is called by a Startup trigger.
 
 The ph_comopen is needed to open the port. This one means "open port COM3 and reference it as COM control 4, and call the CID macro when data arrives".
 
 The "at#..." is for my modem. Yours would be "at+vcid=1\013". The \013 is just an ASCII 13 (carriage return or <cr>). This is like pressing <Enter> in Hyperterm.
 
  Edited by TonyNo - February 11 2008 at 13:48
         | 
        
       
        | Back to Top | 
         
          
          
         | 
        
       
       
        |   | 
       
        
         
         Gadgets Senior Member 
          
  
  Joined: January 28 2008 Location: Canada
 Online Status: Offline Posts: 178
          | 
        
         
          
           | Posted: February 11 2008 at 14:36 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
 
TonyNo wrote: 
   
    
    
      
       Wow. I just saw this. Stupid forum software.    
 
 Yes, I have a SETUP macro that runs when PH starts. This is called by a Startup trigger.
 
 The ph_comopen is needed to open the port. This one means "open port COM3 and reference it as COM control 4, and call the CID macro when data arrives".
 
 The "at#..." is for my modem. Yours would be "at+vcid=1\013". The \013 is just an ASCII 13 (carriage return or <cr>). This is like pressing <Enter> in Hyperterm.
  | 
       
       | 
    
    | 
 
  
 
 OOOOH. ok then. I'll give it a whirl and pray it works! :-)
 
  Thank you!
  __________________ Friends, don't let friends install Norton Products
         | 
        
       
        | Back to Top | 
         
          
          
         | 
        
       
       
        |   |       
      | 
    
   
  |