SIP/2.0 483 Too Many Hops in Lync or SIP

EXAMPLE:

SEND --->


INVITE sip:callcentric.aaronin@sipsorcery.com;rinstance=232176 SIP/2.0
Via: SIP/2.0/UDP 204.11.192.37:5080;branch=z9hG4bK-6220bc0291f0e295c657a17fb7dbb588
To: <sip:17772276267@callcentric.com>
From: "Aaron Clauson" <sip:17772775881@callcentric.com>;tag=1752560849
Call-ID: 207152c94f98412c806f50c8f27f837f
CSeq: 2 INVITE
Contact: <sip:d24badac8b78c0ec1978a624b56e6050@204.11.192.37:5080;transport=udp>
Max-Forwards: 13
Content-Length: 342
Content-Type: application/sdp

v=0
o=Cisco-SIPUA 4475 0 IN IP4 204.11.192.37
s=SIP Call
c=IN IP4 204.11.192.37
t=0 0
m=audio 59826 RTP/AVP 8 0 18 101
c=IN IP4 204.11.192.37
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/0
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=silenceSupp:off - - - -
a=setup:actpass
 RECEIVE --->
SIP/2.0 483 Too Many Hops
Via: SIP/2.0/UDP 69.59.142.213:5060;branch=z9hG4bKaf9695a95c294f22b5ecf7c1ba17dbd7;rport=5060
To: <sip:17772276267@in.callcentric.com>
From: "Aaron Clauson" <sip:17772775881@callcentric.com>;tag=1146592129
Call-ID:
207152c94f98412c806f50c8f27f837f
CSeq: 2 INVITE
Content-Length: 0


This happens due to  Max-Forwards:
Here max-forwards is 13 which becomes zero but still didn't reach the destination as a result returns Too Many Hops .

How to make your laptop as wifi hotspot

Requirement:

System: Wifi Supported System.
OS: Windows 7 (Virtual wifi router available on only >= 7 OS)

How:

Step 1: Click Start, type cmd, right-click the cmd.exe link and select "Run as Administrator".

Step 2:  Now type the following command --

netsh wlan set hostednetwork mode=allow ssid=MyWifi key=Password
Password must be  (8 <= length)

Step 3: Now enable your virtual wifi by --

netsh wlan start hostednetwork
 Step 4: Now share your current networks' internet to the virtual wifi. For this go to --

control panel --> Network and Sharing Center -->Change Adapter Settings

Step 5: Now Select your current local area connection and by double clicking on the icon go to the status window.
 
                                              Fig: 5-8 Step
Step 6: Now  from status window click on properties button and select the sharing Tab from the property window.

 Step 7: From share tab check on Allow other network user connect through this PC's internet connection.

Step 8: Select your virtual wifi hotspot from the drop down list of  Home networking connection.

Click ok and you are done!


Now enable laptop wifi and use this virtual wifi in any device to connect with.

 

How to install filezilla in centos 6.x

Description: FileZilla is a client program for uploading and downloading the data or file from a remote PC. It supports FTP, FTPS, SFTP.


How to install :

1. For installing FileZilla you need to have epel repository on your system.

Get it by --

rpm -ivh http://fedora.mirrors.pair.com/epel/6/i386/epel-release-6-8.noarch.rpm
2. Then install it by yum.

yum install filezilla
rpm -ivh http://fedora.mirrors.pair.com/epel/6/i386/epel-release-6-8.noarch.rpm - See more at: http://www.broexperts.com/2013/02/how-to-install-filezilla-on-centos-6-3/#sthash.RWxG1cem.dpuf
rpm -ivh http://fedora.mirrors.pair.com/epel/6/i386/epel-release-6-8.noarch.rpm - See more at: http://www.broexperts.com/2013/02/how-to-install-filezilla-on-centos-6-3/#sthash.RWxG1cem.dpuf
FTP, FTPS and SFTP
FTP, FTPS and SFTP
FTP, FTPS and SFTP
FTP, FTPS and SFTP

can't read "NS": no such variable while executing in GIT-GUI

This issue arise due to incompatible text conversion soft like -- for not founding the libidn , zlib,
curl. And this issue is available on every other version of git that are lower from 1.7.5.
 
So manually build and install the git-1.7.5 and fix your problem.
 
 
yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel
cd /usr/local/src
wget ftp://na.mirror.garr.it/pub/1/sunfreeware/SOURCES/git-1.7.5.tar.gz
tar xzvf git-1.7.5.tar.gz
cd git-1.7.5
./configure
make prefix=/usr/local all
make prefix=/usr/local install
 
 
After that you need to install git-gui by --
 
yum install git-gui
So now you can use real git in git-gui. 
 

Enable mp3 in RhythmBox in Centos

Step 1:  Open linux console in root .

Step 2: Go to the yum directory by -

cd /etc/yum.repos.d/
Step 3: Get the yum repository for RhythmBox by the following command -

wget http://pkgrepo.linuxtech.net/el6/release/linuxtech.repo

Step 4: Now install by yum --

          yum install rhythmbox .

Step 5: Now install 2 plug-in for .mp3 extension.

yum install gstreamer-plugins-ugly 
yum install gstreamer-plugins-bad
You are done!

Install MPlayer in CentOs or Unix

Step 1:  Open linux console in root .

Step 2: Go to the yum directory by -

cd /etc/yum.repos.d/
Step 3: Get the yum repository for MPlayer by the following command -

wget http://pkgrepo.linuxtech.net/el6/release/linuxtech.repo

Step 4: Now install by yum --

          yum install mplayer .


You are done!

Install VLC in Centos or Unix

Step 1:  Open linux console in root .

Step 2: Go to the yum directory by -

cd /etc/yum.repos.d/
Step 3: Get the yum repository for VLC by the following command -

wget http://pkgrepo.linuxtech.net/el6/release/linuxtech.repo

Step 4: Now install by yum --

          yum install vlc .


You are done!


error:: sql.h: No such file or directory in Centos or Unix

This error arise when we want build an data base related class or function in our native project in centos or unix.


 error:: sql.h: No such file or directory

Solution: 

Install ODBC in your system.

Command:

yum install unixODBC*  --->>> for centos


How to copy file from and to remote PC in linux, centos

Case 1: How to downloading or copying file from remote PC?

Ans: Do it by the following  command --


scp -r user@remote_pc_ip:/path/to/downloadable/file  /your/pc/path

After that the command line will ask for password. Give it and download the file.


Case 2: How to upload or copy file to remote PC?

Ans: Do it by the following  command --


scp -r  /your/pc/path/for/file  user@remote_pc_ip:/path/to/upload/a/file

After that the command line will ask for password. Give it and upload the file.

Samba Centos root share error - You do not have permission to access in windows

Description:

You have a Centos PC and trying to access the root user's Desktop from a Windows PC. You can see the shared folder in the \Network\Centos_PC_IP, but can't access the folder when you double click.

The pop window arise with a error -

You do not have permission to access in windows \\CENTOS_IP\\root. Contact your network administrator to request access.





Solution: 

First you need to check you samba settings in your centos pc by command -
 
testparm
 
After that you need to do a little change o your /etc/samba/smb.conf file.

Find the folder you shared from root in this file.

It will be like --

        [root]
        path = /root/Desktop
        read only = No 

Change it to -

        [root] 
        force user = root
        force group = root 
        path = /root/Desktop
        read only = No 

 And restart the samba by --

        /sbin/service smb restart
 
And you are done!


[Solved by Abdullah Al Mamun @ Eyeball Networks Inc]

How to share (read/write) any folder with root permissions in centos 6 or linux

Question:

Now a days many people like software developers uses 2 or more OS. So the people who have multiple PC's with different OS need to share the files or folder between them. So how?


Solution:

Requirement:

i.  Samba
ii. LAN connection

Step 1. Install samba by giving command in centos console -
 
                           yum install samba

Step 2. Configure samba by opening smb.conf 

                           vi /etc/samba/smb.conf

i. Create a workgroup in which you are going to share the files/folders.

by default it is like -

                  workgroup = MYGROUP
change it to -
                                

netbios name = your_host_name 
workgroup = workgroup

because windows system has default group named as WORKGROUP.

ii. Now create a shared resource , where you will indicate the path of the folder you want to share.

        [myshare]
        path = /root/Desktop/share
        writeable = yes 
Where [myshare] is the folder name what you want people to see in their PC.
"path" is the path of your shared folder.

Step 3. Make sure your firewall allows SAMBA.

Step 4. Now test the settings of SAMBA by --

# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
Processing section "[myshare]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
Step 5. Disable SELinux by-      
setenforce 0

        To permanently set it modify the /etc/selinux/config file and set the value of -

SELINUX = permissive

Step 6. Restart SAMBA by -

/sbin/service smb restart


Now you are done!



 
 

How to start or open new activity or window from one window on button click

Requirement: You want to make an "app", which displays a login screen, and users can log in. If the login is correct,  open a new window, where users can do other staff. Then how can you do this?


Ans:

Step 1. Create a layout xml for the new window. In my case I have created one
named newwindow.xml . The entry are as follows --

<?xml version="1.0" encoding="utf-8"?>
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#9999FF" >
   </Gallery>

Step 2. Create a class with extending Activity .

Step 3. On that new class add --

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.newwindow);
    }

Here newwindow is the layout xml.

Start Up window is given bellow --




















Step 4. Add the new class on AndroidManifest.xml


Note that, if you don't add the class on AndroidManifest.xml app will crash ("the app stopped unexpectedly").


Step 5. Now add the following where you want to initiate this new activity or window ---


Intent intent = new Intent(getApplicationContext(), NewWindow.class);
                    startActivity(intent);
 That's all!


Now If you add it on button click then the output will be --

You can see that the new windows background colour is "#9999FF" .


The constructor Intent(new View.OnClickListener()) is undefined

Issue:
The constructor Intent(new View.OnClickListener(){}, Class<NewWindow>) is undefined.



Solution: Find out --

Intent intent = new Intent(this, NewWindow.class);

Change the this to getApplicationContext() or StartClass.this .

 

How to add button action for multiple button in android

In android it is extreme necessary to use button and do many thing on click or touch of this button.

So how you can do this ?


Ans:   It's pretty simple!

Just find out the -- findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);

It is generated by default in new android sdk. The bold portion is the touch listener for button which is implemented on bellow of your main activity class.
You can do your thing on overriden function OnTouch.


If you want to do it for click and many button here is the way --

findViewById(R.id.dummy_button).setOnClickListener(ButtonListener);

View.OnClickListener ButtonListener = new View.OnClickListener(){

        public void onClick(View view) {
            switch (view.getId()) {

                case R.id.dummy_button:
                      setContentView(R.layout.newwindow);
                      break;
                case R.id.dummy_button1:
                      setContentView(R.layout.newwindow1);
                      break;
                case R.id.dummy_button2:
                      setContentView(R.layout.newwindow2);
                      break;
  
                  }
        }

    };

newwindow,
newwindow1,
newwindow2

are the layouts .

How to move or put the android button in the middle of the screen

Ques: How to centre buttons on screen horizontally and vertically ?

Default Screen:




Ans: You need to use a Relative Layout for android GUI in the activity_fullscreen.xml  or whatever you name it. You just need to add the android:layout_centerInParent="true" on your relative layout scope.

In default android generate the layout as linear layout for your GUI activity. In that activity you can't use android:layout_centerInParent="true".


It will generate warning as ---

Invalid layout param in a LinearLayout: layout_centerInParent    activity_fullscreen.xml    /YourProject/res/layout    line 52    Android Lint Problem
How?:  

Step 1. First open the layout xml from /YourProject/res/layout .

Step 2. Change all of the <FrameLayout> ... </FrameLayout> to <RelativeLayout> ... </RelativeLayout>

Step 3.  Delete default button code portion from you xml and add the following

    <RelativeLayout
            android:id="@+id/fullscreen_content_controls"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:orientation="vertical"
            tools:ignore="UselessParent" >

            <Button
                android:id="@+id/dummy_button"
                android:layout_width="180dip"
                android:layout_height="80dip"
                android:layout_centerInParent="true"
                android:layout_marginTop="100dip"
                android:text="@string/dummy_button" />
        </RelativeLayout>
Step 4. Use the bold attribute to arrange your button on screen.


Now the output looks like ---





Threaded multi Chat room client source code in c++ with MFC Part - 3

PREVIOUS


ClientDlg.cpp is the class where all the action from user's are taken and initiated. The interaction with GUI to logic is so great and easy which will help any developer to understand the flow of code.

Function for login --

void CClientDlg::OnBnClickedButton2()
{
    // TODO: Add your control notification handler code here
    cTh = AfxBeginThread(
    StaticThreadFunc,
    this);
    
   m_Thread_handle = cTh->m_hThread;
}
Start the thread for a login action.

UINT __cdecl CClientDlg::StaticThreadFunc(LPVOID pParam)
{
    CClientDlg *pYourClass = reinterpret_cast<CClientDlg*>(pParam);
    UINT retCode = pYourClass->ThreadFunc();

    return retCode;
}

UINT CClientDlg::ThreadFunc()
{
    // Do your thing, this thread now has access to all the classes member variables
   

    CString txtname;
    GetDlgItemText(IDC_EDIT2, txtname);

    CString portname;
    GetDlgItemText(IDC_EDIT3, portname);
    int iPort = _wtoi( portname.GetString() );
   
    CString username;
    GetDlgItemText(IDC_EDIT6, username);

    m_pClient = new ClientCon(this);

    CT2CA CStringToAscii(txtname);

      // construct a std::string using the LPCSTR input
     std::string sResultedString (CStringToAscii);
    
    CT2CA CStringToAscii2(username);

    std::string sResultedString2 (CStringToAscii2);

    m_pClient->StartConnect(sResultedString, iPort, sResultedString2);
    return 0;
}
 Used to take input from text box and send it to ClientCon class and start the Connection with server.

void CClientDlg::OnBnClickedButton4()
{
    // TODO: Add your control notification handler code here
    CString sTextData;
    GetDlgItemText(IDC_EDIT7, sTextData);
   
    CT2CA CStringToAscii(sTextData);

      // construct a std::string using the LPCSTR input
     std::string sResultedString (CStringToAscii);
     if(m_pClient != NULL)
     m_pClient->SendData(sResultedString);
     CWnd* pWnd = GetDlgItem(IDC_EDIT7);
     pWnd->SetWindowText(_T(""));
}

This function used to send the data to server for relay the messages to other client.


Complete Source Code SERVER and CLIENT:

DOWNLOAD

Threaded multi Chat room client source code in c++ with MFC Part - 2

PREVIOUS                                                                                                                               NEXT



Client.cpp class is the MFC GUI initiation class. You can have a look here ..


BOOL CClientApp::InitInstance()
{
    // InitCommonControlsEx() is required on Windows XP if an application
    // manifest specifies use of ComCtl32.dll version 6 or later to enable
    // visual styles.  Otherwise, any window creation will fail.
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    // Set this to include all the common control classes you want to use
    // in your application.
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinApp::InitInstance();


    AfxEnableControlContainer();

    // Create the shell manager, in case the dialog contains
    // any shell tree view or shell list view controls.
    CShellManager *pShellManager = new CShellManager;

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    // of your final executable, you should remove from the following
    // the specific initialization routines you do not need
    // Change the registry key under which our settings are stored
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    CClientDlg dlg;
    m_pMainWnd = &dlg;
    INT_PTR nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
        // TODO: Place code here to handle when the dialog is
        //  dismissed with OK
    }
    else if (nResponse == IDCANCEL)
    {
        // TODO: Place code here to handle when the dialog is
        //  dismissed with Cancel
    }

    // Delete the shell manager created above.
    if (pShellManager != NULL)
    {
        delete pShellManager;
    }

    // Since the dialog has been closed, return FALSE so that we exit the
    //  application, rather than start the application's message pump.
    return FALSE;
}

Threaded multi Chat room client source code in c++ with MFC Part - 1

As in my previous post I have talk about server , now it's time for client. This client will use as multi chat client with our very own server. In this client you need to provide server IP ,PORT and an USERNAME.

Then just click the log in button and you are in if you get an welcome message from server.




Technology used:

i.   C++
ii.   Microsoft visual Studio 2010
iii.  MFC GUI
iv.  Winshock2 Socket
v.   TCP/UDP
vi.  Windows Thread


This project consist of  3 classes.

1. Client.cpp
2. ClientDlg.cpp
3. ClientCon.cpp


Lets start with core portion -- I mean the network level connection portion.

I have used the Winshock2 library for the purpose of network communication.

You can use this library on windows  with MVS 2010 by including library --


# include <winsock2.h>

And as it is multi user  and have GUI so we need thread. For this I have used Windows thread.
You can use this windows thread just by adding ---

# include <Windows.h>

So,  why we are late. Lets start....

ClientCon.cpp -- class works for network level connection and data send receive.

void ClientCon::StartConnect(string sAddress, int iPort, string sUsername)
{
    struct sockaddr_in server;
    char *message , server_reply[2000];
    int recv_size;
    m_pUser = sUsername;

    printf("\nInitialising Winsock...");
    if (WSAStartup(MAKEWORD(2,2),&wsa) != 0)
    {
        printf("Failed. Error Code : %d",WSAGetLastError());
        return;
    }
    
    printf("Initialised.\n");
    
    //Create a socket
    if((s = socket(AF_INET , SOCK_STREAM , 0 )) == INVALID_SOCKET)
    {
        printf("Could not create socket : %d" , WSAGetLastError());
    }

    printf("Socket created.\n");
    
    
    server.sin_addr.s_addr = inet_addr(sAddress.c_str());
    server.sin_family = AF_INET;
    server.sin_port = htons( iPort );

    //Connect to remote server
    if (connect(s , (struct sockaddr *)&server , sizeof(server)) < 0)
    {
        puts("connect error");
        return;
    }
    
    puts("Connected");
    
    //Receive a reply from the server
    while((recv_size = recv(s , server_reply , 2000 , 0)) != SOCKET_ERROR)
    {
        puts("Reply received\n");

        //Add a NULL terminating character to make it a proper string before printing
        server_reply[recv_size] = '\0';
        puts(server_reply);

        string sTempMsg ="\n"+string(server_reply)+"\n";
        m_pClient->ShowServerInfo(sTempMsg);
    }
   
}
 On StartConnect() Client initiate its socket and connect with server. Client also start listening for messages from server here. All the message from other client will traverse through server and will reach to every client.

This Class also have the function to send the message to server/other client.


void ClientCon::SendData(string sMessage)
{
    string sTemp = m_pUser +">>"+ sMessage+"\n";

    if( send(s , sTemp.c_str(), sTemp.size() , 0) < 0)
    {
        puts("Send failed");
        return;
    }
}
 This function is used to send the messages to the server by concatenating the user name to the messages.



COMPLETE CODE

NEXT

Threaded multi chat room server source code in c++ with MFC Part - 3

PREVIOUS 

Now we will talk about the other MFC GUI portion which I have created and used threaded model.

When in GUI the start button is clicked by providing port number on PORT text box this server start by creating a thread independent from GUI. You can start the server by ENTER also.


Here is some code snap for help --


void CServerDlg::OnBnClickedButton1()
{
    // TODO: Add your control notification handler code here

    cTh = AfxBeginThread(
    StaticThreadFunc,
    this);
   
    //cTh->m_bAutoDelete = FALSE;
    m_Thread_handle = cTh->m_hThread;
   
}
Here we create a windows thread for back end action.

UINT __cdecl CServerDlg::StaticThreadFunc(LPVOID pParam)
{
    CServerDlg *pYourClass = reinterpret_cast<CServerDlg*>(pParam);
    UINT retCode = pYourClass->ThreadFunc();

    return retCode;
}

UINT CServerDlg::ThreadFunc()
{
    // Do your thing, this thread now has access to all the classes member variables
    CString txtname;
    GetDlgItemText(IDC_EDIT1, txtname);
    int iPort = _wtoi( txtname.GetString() );

    if(iPort == 0)
    {
        return -1;
    }
    m_pServer = new ServerManager(this);
    m_pServer->StartListening(iPort);
    return 0;
}
On ThredFunc() we take the input from text box and pass this value on to ServerMnager class and start the server.


Threaded multi chat room server source code in c++ with MFC Part - 2

PREVIOUS


 we will now demonstrate about the class Server.cpp .

This class is the start point of the server project. It is basically used to call the MFC instance.

There will be some preview of the class here as MFC is out of scope  at the moment --


BOOL CServerApp::InitInstance()
{
    // InitCommonControlsEx() is required on Windows XP if an application
    // manifest specifies use of ComCtl32.dll version 6 or later to enable
    // visual styles.  Otherwise, any window creation will fail.
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    // Set this to include all the common control classes you want to use
    // in your application.
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinApp::InitInstance();


    AfxEnableControlContainer();

    // Create the shell manager, in case the dialog contains
    // any shell tree view or shell list view controls.
    CShellManager *pShellManager = new CShellManager;

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    // of your final executable, you should remove from the following
    // the specific initialization routines you do not need
    // Change the registry key under which our settings are stored
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    CServerDlg dlg;
    m_pMainWnd = &dlg;
    INT_PTR nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
        // TODO: Place code here to handle when the dialog is
        //  dismissed with OK
    }
    else if (nResponse == IDCANCEL)
    {
        // TODO: Place code here to handle when the dialog is
        //  dismissed with Cancel
    }

    // Delete the shell manager created above.
    if (pShellManager != NULL)
    {
        delete pShellManager;
    }

    // Since the dialog has been closed, return FALSE so that we exit the
    //  application, rather than start the application's message pump.
    return FALSE;
}


PREVIOUS                                                                                                                                    NEXT

Threaded multi chat room server source code in c++ with MFC Part - 1

Multi-client chat server is open source as I have created it. In this server multiple user can log in and communicate with one another as multicast user. In reality it can use as a chat room server. Can be modified as peer to peer (p2p) text chat. It can also be used as a backbone of a video conferencing project. It has a beautiful and easy to use user interface in MFC. This project is compatible with Microsoft visual studio 2010. I will describe the use of class and function with source code.




Technology used:

i.   C++
ii.   Microsoft visual Studio 2010
iii.  MFC GUI
iv.  Winshock2 Socket
v.   TCP/UDP
vi.  Windows Thread


This project consist of  3 classes.

1. Server.cpp
2. ServerDlg.cpp
3. ServerManager.cpp


Lets start with core portion -- I mean the network level connection portion.

I have used the Winshock2 library for the purpose of network communication.

You can use this library on windows  with MVS 2010 by including library --

# include <winsock2.h>

And as it is multi user  and have GUI so we need thread. For this I have used Windows thread.
You can use this windows thread just by adding ---

# include <Windows.h>

So,  why we are late. Lets start....


ServerManager.cpp  -- core network connection class. In that class I have also demonstrate how to fetch the remote client IP address from a socket connection.


void ServerManager::StartListening(int iPort)
{
    iCount=0;
printf("\nInitialising Winsock...");
    if (WSAStartup(MAKEWORD(2,2),&wsa) != 0)
    {
        printf("Failed. Error Code : %d",WSAGetLastError());
        return;
    }
    
    printf("Initialised.\n");
    
    //Create a socket
    if((s = socket(AF_INET , SOCK_STREAM , 0 )) == INVALID_SOCKET)
    {
        printf("Could not create socket : %d" , WSAGetLastError());
        m_pDialog->ShowServerInfo("Could not create socket");
    }

    printf("Socket created.\n");
    
    //Prepare the sockaddr_in structure
    server.sin_family = AF_INET;
    server.sin_addr.s_addr = INADDR_ANY;
    server.sin_port = htons( iPort );
    
    //Bind
    if( bind(s ,(struct sockaddr *)&server , sizeof(server)) == SOCKET_ERROR)
    {
        printf("Bind failed with error code : %d" , WSAGetLastError());
        m_pDialog->ShowServerInfo("Bind failed with error code");
        exit(EXIT_FAILURE);
    }
    
    puts("Bind done");

    //Listen to incoming connections
    listen(s , 100);
     char *message;
     puts("Waiting for incoming connections...");
     m_pDialog->ShowServerInfo("Waiting for incoming connections...\n");
     c = sizeof(struct sockaddr_in);
    
    while( (new_socket = accept(s , (struct sockaddr *)&client, &c)) != INVALID_SOCKET )
    {
        puts("Connection accepted");
      
        socklen_t len;
        struct sockaddr_storage addr;
        char ipstr[INET6_ADDRSTRLEN];
        int port;

        len = sizeof addr;
        getpeername(new_socket, (struct sockaddr*)&addr, &len);

        // deal with IPv4:
        if (addr.ss_family == AF_INET) {
            struct sockaddr_in *s = (struct sockaddr_in *)&addr;
            port = ntohs(s->sin_port);
            inet_ntop(AF_INET, &s->sin_addr, ipstr, sizeof ipstr);
        }

        printf("Peer IP address: %s\n", ipstr);
        m_pDialog->ShowServerInfo("Connected Peer IP address: "+string(ipstr)+"\n");
        CWinThread *cTh = AfxBeginThread(
        DataThreadFunc,
        (LPVOID)new_socket);
        ++iCount;
        sArray[iCount] = new_socket;
    }
    
    if (new_socket == INVALID_SOCKET)
    {
        printf("accept failed with error code : %d" , WSAGetLastError());
        return;
    }
}
StartListening(int iPort) Initiate a socket and Start listening on a particular port for incoming connections.

This bold letter means it can accept multiple connection( client ). In that function we used a static global variable to count the connection globally and a global static SOCKET array to stored the socket's pointer for future use from thread.

How ?

You can see on that function I have used windows thread. Here I accept the incoming connection and make a thread for every connection.

You can see that with the function --


UINT __cdecl ServerManager::DataThreadFunc(LPVOID pParam)
{
    SOCKET pYourSocket = reinterpret_cast<SOCKET>(pParam);
  
    char *message;
    message = "Welcome to Matrix chat room.\n";
    send(pYourSocket , message , strlen(message) , 0);
    char server_reply[2000];
    int recv_size;

    while((recv_size = recv(pYourSocket , server_reply , 2000 , 0)) != SOCKET_ERROR)
    {
        server_reply[recv_size] = '\0';
         for(int i = 1;i<=iCount; i++)
        {
            if( send(sArray[i] , server_reply, recv_size , 0) < 0)
            {
                puts("Send failed");
             }
        }

    }
    return 0;
}
In DataThreadFunc(LPVOID pParam) I have used the winshock send() API to sending the welcome to the client by client socket.
Here I also have a while loop with recv() API which continue to listening for client messages.
This is a static function which is called for every incoming connection for 1 time.

After receiving a message from a client this thread server now sends this message to every socket it has on its SOCKET array by fetching the socket.

NOTE :  Any smart mind can modified this function and can use for p2p message chat.


COMPLETE CODE


 NEXT



How to take input from a MFC Edit Control as string, convert it to integer and append text to it

 Take input from a MFC Control as string :

CString txtname;
GetDlgItemText(IDC_EDIT1, txtname);

Here IDC_EDIT1 is the Control Edit Text and txtname is the input at the moment we call.

Convert it to integer or int :

int iPort = _atoi( txtname.GetString() );

int iPort = _wtoi( txtname.GetString() );
// if you use wide charater formats
 
 
Append text to Edit Control :
 
void CServerDlg::AppendTextToEditCtrl(CEdit& edit, LPCTSTR pszText)
{
   // get the initial text length
   int nLength = edit.GetWindowTextLength();
   // put the selection at the end of text
   edit.SetSel(nLength, nLength);
   // replace the selection
   edit.ReplaceSel(pszText);
}

How to stop a blocking thread from another function that start in other in MFC

ISSUE: In server client scenario it is mandatory to use thread where sever is listening on a particular port.
Now in click of stop button ,how to stop this running thread.


SOLUTION:

#include <Windows.h>

HANDLE m_Thread_handle;
CWinThread *cTh;
static UINT __cdecl StaticThreadFunc(LPVOID pParam);
UINT ThreadFunc();
Step 1. Declared these on header file.

Step 2. Starting the thread from a function or button click ---


void CServerDlg::OnBnClickedStart()
{
    // TODO: Add your control notification handler code here

    cTh = AfxBeginThread(
    StaticThreadFunc,
    this);
    m_Thread_handle = cTh->m_hThread;
}
Step 3. Thread initialization function --

 UINT __cdecl CServerDlg::StaticThreadFunc(LPVOID pParam)
{
    CServerDlg *pYourClass = reinterpret_cast<CServerDlg*>(pParam);
    UINT retCode = pYourClass->ThreadFunc();

    return retCode;
}
Step 4. Work processing function for thread --

UINT CServerDlg::ThreadFunc()
{
    // Do your thing, this thread now has access to all the classes member variables
    CString txtname;
    GetDlgItemText(IDC_EDIT1, txtname);
    int iPort = _wtoi( txtname.GetString() );
    m_pServer = new ServerManager(this);
    m_pServer->StartListening(iPort);
             // while loop on start listening that are blocking call
    return 0;
}
Step 5. Now to close the thread from clicking stop button ---

void CServerDlg::OnBnClickedStop()
{
    // TODO: Add your control notification handler code here
    CloseHandle(m_Thread_handle);
    delete m_pServer;
}

This Android SDK requires Android Developer Toolkit version 22.0.0 or above.

ISSUE: This Android SDK requires Android Developer Toolkit version 22.0.0 or above.  Current version is 21.1.0.2013-2-6-0-46.  Please update ADT to the latest version.



SOLUTION:

  1. Run Eclipse as administrator.
  2. Go to HelpInstall New Software.
  3. On Work with: type https://dl-ssl.google.com/android/eclipse/ and press ENTER.

  4. Wait for Eclipse to fetch the repository. An item named Developer tools will appear in the list.
    Mark it for install, press Next and follow the steps to install the ADT tools.
  5. When finished, it will ask to restart Eclipse. Make sure you do this.
  6. When Eclipse restarts, all your Android SDK packages should show up again.

GUI hanged on button pressed or some action initiation in MFC project

ISSUE: In a GUI project there is lots of calculation and works are needed to be done in background when necessary . So when a button pressed or a certain action initiate the GUI may stop responding for you.


SOLUTION: In default when a MFC project is created the GUI portion has thread. So make sure the other necessary works are done on another thread (eg: calculation, process, response , internet query ).

You can have a better and great idea about thread use in mfc from this simple post

Best design for windows multi thread in a c++ class

ISSUE: How to create windows multi-threaded program in  c++ ?


SOLUTION:  Now a day maximum project or software has multiple process running at a same process.Or a gui application needs to do some work on background which is blocking. Or may be you are going to design or create a network application ,so it becomes mandatory to be an expert of Threading now a days.


Here is  the template which I follow.

In header file add the followings --

#include <Windows.h>

static UINT __cdecl CallingFunctionForThread(LPVOID pParam);
UINT WorkingFunction();
 
 
In CPP file add the followings --

UINT __cdecl MyClass::CallingFunctionForThread(LPVOID pParam)
{
    MyClass *pMyClass= reinterpret_cast<MyClass*>(pParam);
    UINT ret = pMyClass->WorkingFunction();

    return ret;
}

UINT MyClass::WorkingFunction()
{ 
    // You can do anything as a class member function and run it on your thread.
}
Start thread  from any where by adding the followings --
 
 AfxBeginThread(
    CallingFunctionForThread,
    this); 
 

How to convert between 'CString' and 'std::string' ?

ISSUE:

When you are developing MFC project in most cases it becomes necessary to convert between 'CString' and 'std::string' .

SOLUTION:

'CString' to 'std::string':


 CString sTest ("Matrix");

  // Convert a TCHAR string to a LPCSTR
 CT2CA CStringToAscii(sTest);

  // construct a std::string using the LPCSTR input
 std::string sResultedString (CStringToAscii);


'std::string' to 'CString':

std::string sTest("Matrix");
CString ResultedCString(sTest.c_str());
 

IntelliSense: #error directive: Please use the /MD switch for _AFXDLL builds in Visual Studio 2010 MFC project

ERROR:    

error C2001: newline in constant

IntelliSense: #error directive: Please use the /MD switch for _AFXDLL builds    c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxver_.h    81    3



   
Solution:
There's a bug where the settings of a generated MFC project would show "Multi-threaded Debug DLL (/MDd)"; however, it doesn't pass that argument to the intellisense engine. To workaround this problem, please try the following:

Step 1. Right-click the Project.

Step 2. Go to Config Properties->C/C++-> Code Gen ->. Double-click "Runtime Library" and set to "Multi-threaded Debug DLL (/MDd)" . If this value already appears to be set, make sure it is by selecting it again (it should then appear as bold).

Step 3. Click OK.

Done!

Lync 2010 client does not login in Lync 2013 server

ISSUE:  Lync 2010 client does not login in Lync 2013 server.


CAUSE:  The cause may be following one from 3.

i.   Client version filter in Lync SERVER
ii.  Network Security: Minimum session security in Lync SERVER



SOLUTION:

i.   Client version filter in Lync SERVER :  Here

ii.  Network Security: Minimum session security in Lync SERVER :  Here


Set NTLM authentication as first choice in lync 2010/2013 server

ISSUE: How to set authentication support NTLM in lync 2010/2013 server as first choice ?


SOLUTION:


Step 1. Run secpol.msc on Lync Front End server

Step 2. Select Local Policies  -> Security Options

Step 3. Open Network Security: Minimum session security for NTLM SSP based (including secure RPC)




Step 4. Tick on Require NTLMv2 session security (default Require 128-bit encryption)

Step 5.  Open second Network Security: Minimum session security for NTLM SSP based (including secure RPC)

Step 6. Tick on Require NTLMv2 session security (default Require 128-bit encryption)


You are done!

How to disable/enable client version filter on Microsoft lync server 2010/2013

ISSUE: How to disable/enable cleint version filter on Microsoft lync server 2010/2013


SOLUTION:

  1. Go to lync server front end. Then open lync server control panel.

  2. In the left navigation bar, click Clients, and then click Client Version Configuration.

  3. On the Client Version Configuration page, double-click the Global configuration in the list.

  4. In the Edit Client Version Configuration dialog box, verify that the Enable version control check box is selected and then, under Default action, select one of the following:
    • Allow   Allows the client to log on if the client version does not match any filter in the Client version policies list.
    • Block   Prevents the client from logging on if the client version does not match any filter in the Client version policies list.
    • Block with URL   Prevents the client from logging on if the client version does not match any filter in the Client version policies list, and include an error message containing a URL where a newer client can be downloaded.
    • Allow with URL   Allows the client to log on if the client version does not match any filter in the Client version policies list, and include an error message containing a URL where a newer client can be downloaded.

  5. If you selected Block with URL, type the client download URL to include in the error message in the URL box.

  6. Click Commit.

SIP/2.0 415 Unsupported Media Type - in lync

ISSUE:  When a lync client make a call to a custom client this issue arise.

SIP/2.0 415 Unsupported Media Type
Via: SIP/2.0/TLS 192.168.0.3:5061;branch=z9hG4bKD46A59CA.99BC04A5AF342A99;branched=FALSE;ms-internal-info="beEdEaEIWfaYJeF8c6BZ3b0XKNdvQ3PyQaRPEpAEarjbWlBLyZ_eZHbgAA"
Via: SIP/2.0/TLS 192.168.0.4:55803;branch=z9hG4bK36072482.06B5227EC88DCA9A;branched=FALSE;ms-received-port=55803;ms-received-cid=162D00
Via: SIP/2.0/TLS 192.168.0.100:50797;received=x.x.x.x;ms-received-port=50797;ms-received-cid=8C00
Record-Route: <sip:FE.domain.local:5061;transport=tls;opaque=state:T:F:Ci.R16a800;lr;ms-route-sig=adlkYhe7OeBeVys8TvobWpLmx2HSLx-xldaLJ-jRlgx4mlBLyZI12ObwAA>;tag=D5120ECF36260EB267FB812D17DAE391
From: "Test User 3" <sip:test3@fe.local>;tag=be345768e2;epid=3bcd1d97b8
To: <sip:demouser@fe.local>;epid=13757352
Call-ID: ff8f03c39c46499db228eab1eb58fed9
CSeq: 1 INVITE
Authorization: NTLM qop="auth", realm="SIP Communications Service", opaque="E74376CA", targetname="FE.domain.local", version=4, crand="13757352", cnum ="5", response="01000000ed10b4deaa20de6f64000000"
Ms-client-diagnostics: 51004; reason="Action initiated by user"
Content-Length: 0

WHY?


This issue arise due to inability of providing support for specific media type. In short--

If you ask a media player to play media it can play.
But, if you ask a media player to open a pdf it is not possible ,because it doesn't have that feature.

SIP/2.0 481 Call Leg Does Not Exist -- in lync

ISSUE 1: When make a call in lync client after certain message transaction lync caller get 481 Call Leg Does Not Exist .


SIP/2.0 481 Call Leg Does Not Exist
Authentication-Info: NTLM qop="auth", opaque="9436E22E", srand="8E281C5D", snum="12", rspauth="010000002be81caccb7d825264000000", targetname="FE.domain.local", realm="SIP Communications Service", version=4
From: <sip:demouser@edge.com>;tag=1375799463;epid=13757994
To: <sip:test3@fe.local>;tag=D5120ECF36260EB267FB812D17DAE391
Call-ID: 2jXhMAF7GVJhUA2Y8r4181MM6OlpCbvsjhzTH2Oc
CSeq: 1 CANCEL
Via: SIP/2.0/TLS x.x.x.x:59631;branch=2OyLJ5KO1GNvDbbGyOpb1pn8l2F1tFUmjiVRcvv1;received=192.168.0.101;ms-received-port=59631;ms-received-cid=1B2E00
ms-diagnostics: 2;reason="See response code and reason phrase";HRESULT="0xC3E93C09(PE_E_TRANSACTION_DOES_NOT_EXIST)";source="FE.domain.local"
Server: RTC/4.0
Content-Length: 0


WHY?

In that case it is not your problem. It means, the call that you are referring is already destroyed or cleaned from the knowledge of lync server.   

ISSUE 2: If this issue arise from remote to local or local to remote lync client call or external to internal moc call then this issue identified as another issue.

SIP/2.0 481 Call Leg/Transaction Does Not Exist

 WHY?

This means your local interface of lync server is failing certificate authentication with public interface of edge server. It means that certificate assignment is not correct for local and public interface of edge server.


SOLUTION: 

1.  Assign public cert to edge server's external interface.
    i).  Make sure that cert has the FQDN of edge server (ex: edge.domain.com)
    ii).  Make sure that cert has the FQDN of sip server (ex:sip.domain.com)
    iii).  Make sure that cert has the FQDN of avauth server (ex:av.domain.com)
    iv).  Make sure that cert has the FQDN of access server (ex:access.domain.com)
    v).  Make sure that cert has the FQDN of webconf server (ex:webconf.domain.com)

2. Assign local certificate to edge server local interface.
3. Assign local certificate to a/v server local interface.

The proper assignment of certificate what to follow has provided by microsoft as follows- 

Subject Name
Subject Alternative Name Entries/Order
CA
EKU
Assign To:
Consolidated Edge
access.contoso.com
sip.fabrikam.com
sip.contoso.com
access.fabrikam.com
access.contoso.com
Public
Server/Client
Access Edge Server
(assign from Edge Interfaces tab)

webcon.contoso.com
N/A
Public
Server
Web Conferencing Edge Server
(assign from Edge Interfaces tab)
ocsedge.contoso.net
N/A
Internal
Server
Internal interface
(assign from Edge Interfaces tab)
avauth.contoso.net
N/A
Internal
Server
A/V Authentication Port
(assign from Edge Interfaces tab)

Make file only build first file of a project in eclipse build makefile

ISSUE: When in a project make clean; make command is given although there is hundreds of files it only build one or first file of a project and stop building.


SOLUTION:  It's easy. Just give command make clean;make all . You file find that your make file is working perfectly.

How to enable HD video in Microsoft Lync

ISSUE:  You can change video resolution on lync client by increasing/decreasing the capture window size. The video resolution change can be either of these following type --

      1. QCIF (176×144) 15fps
      2. CIF (352×288) 15fps
      3. VGA (640×480) 15fps
      4. HD (1280×720) 13fps 

The default video resolution set on lync server normally is VGA .

1. How to know about it?

The answer is here.

2. How to change video resolution it?

Open lync server management shell in administrator mode.
Now give following command ---

Set-CsMediaConfiguration –Identity Global -MaxVideoRateAllowed Hd720p15M
The underline attribute can be either Hd720p15M, VGA600K, and CIF250K.

3. How to make sure that configuration is applied?

The answer in here.

How to know about current maximum video resolution supported by lync server

There are 2 possible way to know about video resolution configuration.

1. The hard way -- from lync server management shell.

Open lync server management shell in administrator mode.
Now give following command ---

Get-CsMediaConfiguration –Identity Global
Output:



 2. Easy way -- smart way from lync client uccapi log with out lync server.

Open uccapi log of lync client from Tracing folder .

Now search by <ucMaxVideoRateAllowed> .You will see that like ---


<ucMaxFileTransferPort>5389</ucMaxFileTransferPort>
<ucPC2PCAVEncryption>SupportEncryption</ucPC2PCAVEncryption>
<ucMaxVideoRateAllowed>Hd720p-1.5M</ucMaxVideoRateAllowed>
<qosEnabled>true</qosEnabled>
<ucDiffServVoice>40</ucDiffServVoice>
<ucVoice802_1p>0</ucVoice802_1p>

Which is your current video resolution configuration.

To change it please follow the procedure describe on here.

400 Malformed route header --"Parsing failure" in federated lync support

ISSUE:   When a lync user start call negotiation with federated user this 400 Malformed route header problem arise.

WHY?

As the federated user's are most of the case out of the local lync server and they are not the user of this local lync server edge end, they often need clear and concrete route header so that server could extract route header value in-order and route the message to remote federated client end.

Example:

Sending:
CANCEL sip:demouser@yy.com;opaque=user:epid:SsEhlbS7GFGJkfHOY836rAAA;gruu SIP/2.0
Via: SIP/2.0/TLS x.x.x.x:33360;branch=18n2L9K88eMlGn7CcctT9RwKSB1FebW397VI5uG1
From: <sip:test@xx.local>;tag=1375467581;epid=13754675
To: <sip:demouser@yy.com>;epid=fd941b3907;tag=9c85c700e3
Call-ID: BHQjMXffBDJ3cWfS4CAvb2wTByEnCZT2xxb7jecK
CSeq: 2 CANCEL
Max-Forwards: 70
User-Agent: Matrix
1. Route: <sip:ddd.yy.local:5061;transport=tls;opaque=state:T;lr>
2. Route: <sip:sip.yy.com:5061;transport=tls;epid=fd941b3907;lr;ms-key-info=AAEAAXibVCEA-ehQqI_OAWg1-HXGy3EkInAKsk_XnfP0Bi3YEKqfMhvIhCCYTmXxe7rq5jzR0t2r-3Xro344SxogHqb7E5u-qup95bHlZZn6TtF_B6acjtJBmBEGBJuMcTDmbFXy8F8yEs4K6be_BnXEbLN4reAl6fnnM3ZiHW3FJ2rlACd7ZmiGZKTQtJSj1UYod0R0xmhp9h2ZVzg0EKgJJRVFiw8Q_CxxejtrSeWz-r_swfbtunQ8Yx5gw4ZOnPA4-5iE9cA0A32UC9sbus5hmoflbHwlLBC6coRgOR77mhHlENEWVD-hu-ST310vDRoPHPHuDESLzfNx51FYaomQhJq3LoIrix0yhm3-SpWpvZukSFlOFQzmLhzKOcp9qDyxFQ5jD_5UceCN2zISwMAM5zJ2S7L8Ul9PbLSUvrPvRZmMQ9gYYXFpNT0W7Kmn5b0BTczTI0RaxyPdSWvttXZHf54aSd5ZBsQjidwe4UfhoM1hKeugfGi4ussirDH3xGl1zTkEx6g2cwkXZVvfCSRFvlE7m8_HivSPlAZ1hhEGB3Yroay9IjaQX_FTTqhivFCUbZxtTH0gtKl2pNUWLWFWPTJWojnepwPiy26qf-TX9_J8On4klv0LNfS4dYbv5QQzGgWI0ugKz0__PDuAlZAg_TkwZwwkK6zIk9fX2iTM9gBeV99Xe140jbJOUW8x;ms-route-sig=cpKH4I1JtS7c8B9C70cuDyHcDmdEwioQpamH2axMYYijK2L-D7sUkAygAA>
3. Route: <sip:edge.local:5060;transport=tls;lr>
4. Route: <sip:front.local:5061;transport=tls;opaque=state:F:Ci.R5d100;lr;ms-route-sig=fa3hMVCHMsTtGw5vppLnUTnejWyRrYeWtU5_2aZCmQ1jTdIktRI12ObwAA>
Authorization: NTLM qop="auth", realm="SIP Communications Service", opaque="514B89F0", targetname="front.local", version=4, crand="13754676", cnum ="7", response="010000007fbad6bfe83cd76e64000000"
Content-Length: 0
 Received:

SIP/2.0 400 Malformed route header
Authentication-Info: NTLM qop="auth", opaque="514B89F0", srand="068FFCAB", snum="9", rspauth="0100000047762b4d20bf8ba564000000", targetname="front.local", realm="SIP Communications Service", version=4
From: <sip:test@xx.local>;tag=1375467581;epid=13754675
To: <sip:demouser@yy.com>;epid=fd941b3907;tag=9c85c700e3
Call-ID: BHQjMXffBDJ3cWfS4CAvb2wTByEnCZT2xxb7jecK
CSeq: 2 CANCEL
Via: SIP/2.0/TLS x.x.x.x:33360;branch=18n2L9K88eMlGn7CcctT9RwKSB1FebW397VI5uG1;received=192.168.0.101;ms-received-port=33360;ms-received-cid=5D100
ms-diagnostics: 1018;reason="Parsing failure";source="front.local"
Server: RTC/4.0
Content-Length: 0


SOLUTION:  When a Lync caller get response (200 OK) against an INVITE request, this response has the Record route:  in order of callee arrangement.  So now you need to make reverse of these Route and used it in caller end. ex: if the order is 1---->3 in callee response ,in caller next request it will be 3--->1 .




488 Not Acceptable Here. - "Client side general processing error." in lync

ISSUE:  This issue arise when any user make a call to other lync user. In summary when there is a issue of INVITE message transaction. 


WHY?

488 Not Acceptable Here  issue arise due to sdp misconstruction or for invalid sdp.

 Sending:
INVITE sip:demouser@yy.com SIP/2.0
Via: SIP/2.0/TLS x.x.x.x:33360;branch=18n2L9K88eMlGn7CcctT9RwKSB1FebW397VI5uG1
From: <sip:test@xx.local>;tag=1375467581;epid=13754675
To: <sip:demouser@yy.com>
Call-ID: BHQjMXffBDJ3cWfS4CAvb2wTByEnCZT2xxb7jecK
CSeq: 1 INVITE
Contact: <sip:test@xx.local;opaque=user:epid:DbsgHp_PWlGCoMke5u6QsgAA;gruu>
Content-Type: application/sdp
Max-Forwards: 70
Supported: ms-dialog-route-set-update
Supported: timer
Supported: histinfo
Supported: ms-safe-transfer
Supported: ms-sender
Supported: ms-early-media
Supported: 100rel
Supported: replaces
Supported: ms-conf-invite
Ms-keep-alive: UAC;hop-hop=yes
Accept-Language: en-US
P-Preferred-Identity: sip:test@xx.local
Allow: INVITE, BYE, ACK, CANCEL, INFO, UPDATE, REFER, NOTIFY, BENOTIFY, OPTIONS
Ms-endpoint-location-data: NetworkScope;ms-media-location-type=Internet
Authorization: NTLM qop="auth", realm="SIP Communications Service", opaque="514B89F0", targetname="front.local", version=4, crand="13754676", cnum ="4", response="01000000856b490601dda29164000000"
Content-Length:  2867

Content-Type: application/sdp
Content-Transfer-Encoding: 7bit
Content-Disposition: session; handling=optional
v=0
o=WIND 3650253204 3948007207 IN IP4 192.168.0.101
s= Jul 23 2013
c=IN IP4 192.168.0.101
t=0 0
m=audio 41520 TCP RTP/SAVP 0 101
a=ice-pwd:CtCRycRIaDo79slChHL05Z0h
a=ice-ufrag:W2GN
a=candidate:1 1 UDP 2130706175 192.168.0.101 41520 typ host
a=candidate:1 2 UDP 2130706174 192.168.0.101 52623 typ host
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:8G/gOa60WGCt67GKSLFK0oBTHeeLjTL65WzpK+NB|2^31
a=rtcp:37661
a=maxptime:200
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=encryption:optional

Received:

SIP/2.0 488 Not Acceptable Here
Via: SIP/2.0/TLS x.x.x.x:33360;branch=18n2L9K88eMlGn7CcctT9RwKSB1FebW397VI5uG1;received=192.168.0.101;ms-received-port=33360;ms-received-cid=5D100
From: <sip:x.x.x.x:5061;transport=tls>;tag=1375467581;epid=13754675
To: <sip:test@xx.local>;epid=6c823739d0;tag=29db7c0aab
Call-ID: BHQjMXffBDJ3cWfS4CAvb2wTByEnCZT2xxb7jecK
CSeq: 1 INVITE
User-Agent: UCCAPI/4.0.7577.0 OC/4.0.7577.0 (Microsoft Lync 2010)
Ms-client-diagnostics: 52001; reason="Client side general processing error."
Content-Length: 0
CAUSE:

In that case this issue arise more invalid  sdp. From sdp we can see
 m=audio 41520 TCP RTP/SAVP 0 101 ---- Invalid
m=audio 41520 TCP/RTP/SAVP 0 101  ---- Valid

DTMF or Telephony event support on SDP and in RTP in Microsoft lync audio conference

DTMF (Dual Tone Multi Frequency) is a type of signaling used primarily in voice telephony systems. It features audible tones in the frequency range of the human voice which are typically used when dialing a call (on analog lines) or when operating an IVR menu. There are many other applications for this signaling. For more information, see the wikipedia article on DTMF (http://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling)

DTMF RTP:

A dtmf packet is 16 bytes.

DTMF data = 12 bytes (RTP header) + 4 bytes (RTP payload)

4 bytes (RTP payload) has mapping of key press value as event. After parsing this 4 bytes the receiver end can get instruction or event what to do.

DTMF SDP:
     
       dtmf payload is 101 . It is passed on audio level of lync SDP.
m=audio 5476 RTP/AVP 101
.
.
.
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

 a=fmtp:101 0-16  indicates the key value that is supported.

DTMF KEY MAPPING:
  1. Start the Lync Server Management Shell: Click Start, click All Programs, click Microsoft Lync Server 2013, and then click Lync Server Management Shell.
  2. Run the following at the command prompt:
    Get-CsDialinConferencingDtmfConfiguration
    
    This cmdlet returns the DTMF settings used for dial-in conferencing.

Default Mapping:

Identity                                                       :  Global
CommandCharacter                                    :  *
MuteUnmuteCharacter                                :  6
AudienceMuteCommand                             :  4
LockUnlockConferenceCommand               :  7
HelpCommand                                            :  1
PrivateRollCallCommand                             :  3
EnableDisableAnnouncementsCommand      :  9
AdmitAll                                                      :  8

DTMF USE:
If you want to mute a call in conference , then in lync key pad just type *6 .