#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Detecting incoming calls


    Hi all,

    A few month ago our developer group started to create an IVR system and now we are working on CRM. To tell the truth it is not an easy task to match all codes appropriately. We are programming in C# and using Visual Studio. It seems we have problems with creating a customer data sheet from a database. Could you provide me any sample code for it?

    Thanks in advance,

    Giovanni
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Detecting incoming calls


    Dear Giovanni,

    The customer data is retrieved from the database by calling the method shown in the code below. This method is defined in the DatabaseConnection class and performs the SELECT commands needed for retrieving the proper data.

    Here is the code i mentioned:

    Code:
    1.	public CustomerDatasheet getCustomerDatasheet(string PhoneNumber)  
    2.	{  
    3.	    DbDataReader reader;  
    4.	    Int64 id;  
    5.	    string fullName;  
    6.	    List<string> phoneNumbers = new List<string>();  
    7.	    SortedDictionary<DateTime, string> notes = new SortedDictionary<DateTime, 
    
    string>();  
    8.	    string sql = string.Format("SELECT c.customer_id, c.fullname, n.phone FROM 
    
    customer c INNER JOIN number n ON c.customer_id = n.customer_id WHERE n.phone = '{0}'", 
    
    PhoneNumber);  
    9.	    reader = this.CreateDbCommand(sql).ExecuteReader();  
    10.	    if (!reader.Read())  
    11.	    {  
    12.	        return null;  
    13.	    }  
    14.	    id = (Int64)reader["customer_id"];  
    15.	    fullName = (string)reader["fullname"];  
    16.	    while (reader.Read())  
    17.	    {  
    18.	        phoneNumbers.Add((string)reader["phone"]);  
    19.	    }  
    20.	    reader.Close();  
    21.	  
    22.	    reader = this.CreateDbCommand(string.Format("SELECT n.created, n.note FROM note 
    
    n WHERE n.customer_id = {0} ORDER BY n.created ASC", id)).ExecuteReader();  
    23.	    while (reader.Read())  
    24.	    {  
    25.	        notes.Add((DateTime)reader["created"], (string)reader["note"]);  
    26.	    }  
    27.	    reader.Close();  
    28.	  
    29.	    return new CustomerDatasheet(id, fullName, phoneNumbers, notes);  
    30.	}
    If you stuck in your project again or you need more help then I recommend you to take a look at voip-sip-sdk[dot]com/p_432-voip-incoming-call-detection-voip[dot]html. (Sorry but I am not allowed to give you the link in its original form because you know, it runs against the rules of the forum.)

    Regards,

    Dr. Amit Kumar

IMN logo majestic logo threadwatch logo seochat tools logo