Okay that sounds good! I try if understand it in the right way:

I call a function in the callback function from the PJSIP (on_incoming_Call);
This function has access to any Widget or to the main window of Qt;
And in this Function I emit a signal;

Have a look at my Pseudo Source Code

uscsippart.cpp: This is the file where the Callbackfunctions of PJSIP are. This callback function is called when someona calls me. And in this function a call another function (incomingCallFunc).

Qt Code:
  1. /* Callback called by the library upon receiving incoming call */
  2. static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
  3. pjsip_rx_data *rdata)
  4. {
  5. pjsua_call_info ci;
  6.  
  7. PJ_UNUSED_ARG(acc_id);
  8. PJ_UNUSED_ARG(rdata);
  9.  
  10. pjsua_call_get_info(call_id, &ci);
  11.  
  12. PJ_LOG(3,(THIS_FILE, "Incoming call from %.*s!!",
  13. (int)ci.remote_info.slen,
  14. ci.remote_info.ptr));
  15.  
  16. /* Automatically answer incoming calls with 200/OK */
  17. pjsua_call_answer(call_id, 200, NULL, NULL);
  18. incomingCallFunc();
  19. }
To copy to clipboard, switch view to plain text mode 

uscinterface.h: here is a "DummyObject" which should has a signal and further here is the prototyp of the function incomingCallFunc();

Qt Code:
  1. #ifndef INTERFACE_H
  2. #define INTERFACE_H
  3.  
  4. #include <QObject>
  5.  
  6. class IncomingCall : public QObject
  7. {
  8. Q_OBJECT
  9.  
  10. public:
  11. IncomingCall(QObject *parent = 0);
  12.  
  13.  
  14. signals:
  15. void incomingCallsignal();
  16. };
  17.  
  18. void incomingCallFunc(void);
  19. #endif
To copy to clipboard, switch view to plain text mode 

uscinterface.cpp: looks like this!

Qt Code:
  1. #include "uscinterface.h"
  2.  
  3. IncomingCall::IncomingCall (QObject *parent)
  4. : QObject(parent)
  5. {
  6. }
  7.  
  8. void incomingCallFunc()
  9. {
  10. // QT Code to emit a signal
  11. }
To copy to clipboard, switch view to plain text mode 

uscgui.h:

Qt Code:
  1. #ifndef USCGUI_H
  2. #define USCGUI_H
  3.  
  4. #include <QWidget>
  5.  
  6. class QLabel;
  7.  
  8. class UscGuiES01 : public QWidget
  9. {
  10. Q_OBJECT
  11.  
  12. public:
  13. UscGuiES01(QWidget *parent = 0);
  14.  
  15. signals:
  16.  
  17. private slots:
  18.  
  19. void makeCall();
  20. void incomingCall();
  21. private:
  22. QLabel *statusLabel;
  23. QPushButton *acceptButton;
  24. QPushButton *hangupButton;
  25. QPushButton *dialButton;
  26. };
  27.  
  28. class UscStatusDisplay : public QWidget
  29. {
  30. Q_OBJECT
  31.  
  32. public:
  33. UscStatusDisplay(QWidget *parent = 0);
  34. };
  35. #endif
To copy to clipboard, switch view to plain text mode 

and now uscgui.cpp: Here I generate my GUI I connect Signals and Slots.

Qt Code:
  1. #include <pjlib.h>
  2. #include <pjlib-util.h>
  3. #include <pjmedia.h>
  4. #include <pjmedia-codec.h>
  5. #include <pjsip.h>
  6. #include <pjsip_simple.h>
  7. #include <pjsip_ua.h>
  8. #include <pjsua-lib/pjsua.h>
  9.  
  10. #include <QtGui>
  11. #include "uscgui.h"
  12. #include "uscinterface.h"
  13.  
  14. UscGuiES01::UscGuiES01(QWidget *parent)
  15. : QWidget(parent)
  16. {
  17.  
  18. statusLabel = new QLabel(tr("???"));
  19.  
  20. dialButton = new QPushButton(tr("Dial"));
  21.  
  22. acceptButton = new QPushButton(tr("Accept"));
  23. acceptButton->setDefault(true);
  24. acceptButton->setEnabled(false);
  25.  
  26. hangupButton = new QPushButton(tr("Hang Up"));
  27. hangupButton->setEnabled(false);
  28.  
  29. UscStatusDisplay *uscGuiStatusDisplay = new UscStatusDisplay;
  30. IncomingCall *incomingCall = new IncomingCall;
  31.  
  32.  
  33. /*
  34.  Insert here the connections for the Signals and Slots
  35.  System
  36. */
  37.  
  38. connect(dialButton, SIGNAL(clicked()),
  39. this, SLOT(makeCall()));
  40.  
  41. connect(incomingCall, SIGNAL(incomingCallsignal()),
  42. this, SLOT(incomingCall()));
  43.  
  44. QHBoxLayout *bottomLayout = new QHBoxLayout;
  45. bottomLayout->addWidget(dialButton);
  46. bottomLayout->addWidget(acceptButton);
  47. bottomLayout->addWidget(hangupButton);
  48.  
  49. QHBoxLayout *topLayout = new QHBoxLayout;
  50. topLayout->addWidget(statusLabel);
  51. topLayout->addWidget(uscGuiStatusDisplay);
  52.  
  53. QVBoxLayout *mainLayout = new QVBoxLayout;
  54. mainLayout->addLayout(topLayout);
  55. mainLayout->addLayout(bottomLayout);
  56. setLayout(mainLayout);
  57.  
  58. setWindowTitle(tr("Universal SIP Client"));
  59.  
  60. emit
  61. }
  62. /*
  63.  Insert here the SLOT Functions
  64. */
  65.  
  66. void UscGuiES01::makeCall()
  67. {
  68. pj_str_t uri = pj_str("sip:nb100149@10.17.1.17");
  69. pjsua_call_make_call(0, &uri, 0, NULL, NULL, NULL);
  70. }
  71.  
  72. void UscGuiES01::incomingCall()
  73. {
  74. acceptButton->setEnabled(true);
  75. hangupButton->setEnabled(true);
  76. }
  77.  
  78. UscStatusDisplay::UscStatusDisplay(QWidget *parent)
  79. : QWidget(parent)
  80. {
  81. setPalette(QPalette(QColor(Qt::green)));
  82. setAutoFillBackground(true);
  83. }
To copy to clipboard, switch view to plain text mode 


Now I want to emit the signal of the class Incomingcall(uscinterface.h) by the function incomingCallFunc() in uscinterface.cpp. but I don't now how??

Or, another possibility, I want to set in this function the Buttons (accept, hangup) enabled and leave the signals and slots out for this part.

So, how can I implement that this function has access to the widget (uscgui.cpp)


I have no idea?

Best Regards...