Symfony2: InactiveScopeException and request

Error message: You cannot create a service (“request”) of an inactive scope (“request”).

You cannot create a service ("request") of an inactive scope ("request").

This message is written, when you’re invoking a command on the command line, e.g.

php app/console assetic:dump

Reason: you are using a request object, but this is not available on the command line / cli

The error was in my case that I used an object in my service configuration that references the request object (MobileDetectBundle).

Solution: remove reference for command line

Step 1 was to use a setter for the reference

Step 2 was to create a special compiler pass in the bundle configuration

Source code (based on – thanks suncat2000!)


namespace Acm\DemoBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

 * CLI listener
class CLIListenerPass implements CompilerPassInterface
     * If CLI, when remove setMobileDetector method from definition mobile_detect.twig.extension
     * @param ContainerBuilder $container 
    public function process(ContainerBuilder $container)
        if (php_sapi_name() == "cli") {
            $definition = $container->getDefinition('acme_demo.extension.my_service');

Call a Skype user in a html page

Introduction to html-based Skype interaction

When the user has installed Skype, one can open Skype directly from a webpage. The protocol is skype:skypename – and optional flags.

The example will use the chinese demo user of Skype (echo-chinese) – which will record a call and play it back or ping back the typed in chat messages.

Call a skype user

The optional flag is call – to force Skype to call somebody. It can also be left out – but if the user changed the default behaviour to e.g. chat – Skype will open an IM session instead. So – go the save way and use the call – flag.

Example: call a Skype user

call echo-chinese with Skype
<a href="skype:echo-chinese?call">call echo-chinese with Skype</a>

Send an Skype IM message to a Skype user

The optional flag is chat. See the example below to see the usage in a html page.

Example: send a chat message to a Skype user

<a href="skype:echo-chinese?chat">Chat with echo-chinese</a>

Send a voicemail to a Skype user

The optional flag is voicemail – as you might have guessed.

Example: send a voicemail to Skype user

<a href="skype:echo-chinese?voicemail">Send voicemail to echo-chinese</a>

Create a Skype conference call with multiple users

This is as easy as the examples above – just more usernames before the “?” and call as flag.

Example: create a Skype conference call

<a href="skype:echo-chinese;echo123?call">conference call with echo-chinese and echo123</a>

Create a conference chat with multiple users

Same as conference call – with chat as flag.

Example: open a conference chat with multiple users – in html

<a href="skype:echo-chinese;echo123?chat">conference chat with echo-chinese and echo123</a>

Register incomming Skype calls with ActiveS in C# .NET

Description of the problem – register incomming Skype calls

Skype allows you to register for incomming calls – you can decide if you wanna take the call or not. ActiveS is a wrapper that allows you to control Skype through an easy API.

Solution: register incomming Skype calls ( C# and .NET )

The solution for Visual Basic is similar.

try {
// initialize Skype / ActiveS
ConversionClass m_objConversion = new ConversionClass();
AccessClass m_objAccess = new AccessClass();
// register event handler that listens on status changes of calls
m_objAccess.CallStatusChanged += new _IAccessEvents_CallStatusChangedEventHandler(Skype_CallStatusChanged);
// connect to Skype
} catch (Exception e) {

// our event handler
void Skype_CallStatusChanged(SKYPEAPILib.Call call, SKYPEAPILib.SkypeCallProgress callProgress)
if (callProgress.Equals(SKYPEAPILib.SkypeCallProgress.prgRinging) && call.Type.Equals(SkypeCallType.ctypIncomingP2P))
// display message box to ask user
MessageBox.Show("Do you wanna take that call from " + call.PartnerDisplayName + "?",
"Incomming Skype-call from " + call.PartnerDisplayName,

// if user answered no, hang up call
call.Status = SKYPEAPILib.SkypeCallProgress.prgFinished;
call.Status = SKYPEAPILib.SkypeCallProgress.prgInProgress;

Hang up a Skype call with C#

Description of the problem: hang up a call with Skype

If you’re using ActiveS to control Skype, it’s easy. If not, you should check if you can migrate to ActiveS – which is really recommended!

Solution – hang up the call

Assuming that the current Call object is called call, you can hang up a call with just changing the status to prgFinished.

call.Status = SKYPEAPILib.SkypeCallProgress.prgFinished;

You can get this Call object with placing an outgoing call (AccessClass.PlaceCall(string username)), taking a call for a call id (AccessClass.GetCall(int callId)) or walking through the list of calls (AccessClass.GetCallList(), returns a list of Call objects).

See also register incomming Skype calls with ActiveS in C#